Strange cloning issue with doors - Solved (:

Non-platform specific questions.

Strange cloning issue with doors - Solved (:

Postby bilvyy » Thu Mar 31, 2011 11:43 pm

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.
Attachments
screenshot2.jpg
Last edited by bilvyy on Fri Apr 01, 2011 12:48 am, edited 2 times in total.
bilvyy
 
Posts: 23
Joined: Wed Feb 16, 2011 2:04 am
Score: 0 Give a positive score

Re: Strange cloning issue with doors - Need help

Postby skydereign » Thu Mar 31, 2011 11:50 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Strange cloning issue with doors - Need help

Postby bilvyy » Fri Apr 01, 2011 12:23 am

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);
}
bilvyy
 
Posts: 23
Joined: Wed Feb 16, 2011 2:04 am
Score: 0 Give a positive score

Re: Strange cloning issue with doors - Need help

Postby skydereign » Fri Apr 01, 2011 12:32 am

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;
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Strange cloning issue with doors - Need help

Postby bilvyy » Fri Apr 01, 2011 12:47 am

thank you so much! i was hoping it'd be something as simple as that. that's fixed the cloning issue perfectly (: thank you.
bilvyy
 
Posts: 23
Joined: Wed Feb 16, 2011 2:04 am
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest