Page 1 of 1

Strange cloning issue with doors - Solved (:

PostPosted: Thu Mar 31, 2011 11:43 pm
by bilvyy
i have been using this code to create doors in my game that allows the player to teleport between places. the code works fine and my player can teleport through the door.

the only problem is that whenever he goes through a door, he seems to clone himself. it looks like a lag or a glitch but it does it every time. is there an error with the code? i don't know what it could be.

i've included a picture of what the player does when he appears through the door. it's like he's leaving behind a trail of himself. the longer you play/the more clones that appear, the slower the game gets. this is a big problem which i must fix ASAP.

Re: Strange cloning issue with doors - Need help

PostPosted: Thu Mar 31, 2011 11:50 pm
by skydereign
The code there is written wrong, but in a way that it wouldn't run if you just copied it... so what code are you actually using? The reason that is happening must be because your variable is not being reset to 0 or you have an event setting it to 1.

Re: Strange cloning issue with doors - Need help

PostPosted: Fri Apr 01, 2011 12:23 am
by bilvyy
i've just noticed that the code is different to the one i got from the demo on that forum. i'm using this:

player > collision (with door) > script editor
Code: Select all
DestroyActor("Event Actor")

leftappear=1;


arrival door > draw actor > script editor
Code: Select all
if(leftappear==1)
{
CreateActor("player","mage","(none)","(none)",0,0,false);
}

Re: Strange cloning issue with doors - Need help

PostPosted: Fri Apr 01, 2011 12:32 am
by skydereign
That would explain it. You need to set the variable leftappear to 0, otherwise it will keep create player actors.
Code: Select all
if(leftappear==1)
{
    CreateActor("player","mage","(none)","(none)",0,0,false);
    leftappear=0;
}

Re: Strange cloning issue with doors - Need help

PostPosted: Fri Apr 01, 2011 12:47 am
by bilvyy
thank you so much! i was hoping it'd be something as simple as that. that's fixed the cloning issue perfectly (: thank you.