Page 1 of 1

respowning?

PostPosted: Thu Nov 10, 2011 4:13 pm
by hunter84
how do you get the player to respown after dying?

Re: respowning?

PostPosted: Thu Nov 10, 2011 10:31 pm
by RippeR7420
There is a couple different ways to do this, One; You can set up checkpoints.
Here is a Tutorial on how to do that:

http://www.youtube.com/watch?v=XQ64cNJui04

Another way you could probably do it is, Create a variable called like "RESPAWN" or something.
In the Player Actor make an event CreateActor->ScriptEditor->

Code: Select all
RESPAWN=0;


Put another event(Pretty sure it doesn't matter which actor, but not positive) -> DrawActor->ScriptEditor->

Code: Select all
if(RESPAWN==1)
{
       CreateActor("Player", "PlayerStandRight", "(none)", "(none)", 240, 160, false);\\ Change the "240" and "160" depending on where you want him to spawn
       RESPAWN=0;
       MoveTo("view", 0.000000, 0.000000, 500.000000, "Game Center", "");


and that should Re-create the player at the beginning of the level, and move the view there also..
Hope I helped you, and If you need anymore help just ask :)

Re: respowning?

PostPosted: Fri Nov 11, 2011 12:16 am
by hunter84
it says error line 3: expected ;

Re: respowning?

PostPosted: Fri Nov 11, 2011 12:23 am
by skydereign
You need to add an ending } (after the MoveTo line). And make sure the comment doesn't fold over into a new line.

Re: respowning?

PostPosted: Fri Nov 11, 2011 12:28 am
by hunter84
after the move to line I did add a } but it still says error: expected ;

Re: respowning?

PostPosted: Fri Nov 11, 2011 1:01 am
by skydereign
Oh, they used \\. Switch the \\ to //. So this.
Code: Select all
if(RESPAWN==1)
{
       CreateActor("Player", "PlayerStandRight", "(none)", "(none)", 240, 160, false);// Change the "240" and "160" depending on where you want him to spawn
       RESPAWN=0;
       MoveTo("view", 0.000000, 0.000000, 500.000000, "Game Center", "");
}

Re: respowning?

PostPosted: Fri Nov 11, 2011 1:16 am
by hunter84
ok i fixed that but when i go into game mode and die he doesn't respawn

Re: respowning?

PostPosted: Fri Nov 11, 2011 1:25 am
by skydereign
Oh, I didn't look really at the code RipperR7420 gave, just how to fix it. The code itself is a bit off, since it spawn the actor relative to the view, then moves the view. So, RipperR7420 assumed that you want the player to respawn at the beginning of the level. So, in the suggested case (240, 160). That means that you'd move the view back to (0, 0).
Code: Select all
if(RESPAWN==1)
{
    CreateActor("Player", "PlayerStandRight", "(none)", "(none)", 240, 160, true);
    RESPAWN=0;
    view.x=0;
    view.y=0;
}

Re: respowning?

PostPosted: Fri Nov 11, 2011 1:38 am
by hunter84
no didn't work but could it be that i dont have a checkpoint? all i want is for the player to respawn when he dies

Re: respowning?

PostPosted: Fri Nov 11, 2011 4:06 am
by skydereign
Yeah, this isn't a method I'd suggest for checkpoints and respawning in general, but I was just using what RipperR7420 was using. My guess is that you are never setting RESPAWN equal to 1. When the player dies, so in its DestroyActor event, you'll need to set RESPAWN to 1, if you want the view to create the player again.
Player -> Destroy Actor -> Script Editor
Code: Select all
RESPAWN=1;

Re: respowning?

PostPosted: Fri Nov 11, 2011 3:09 pm
by RippeR7420
That code is also meant for iphone(rotated left) resolution.. 480x 320y.
and thanks Sky for fixin my mistake :)

If you post your code, or upload a .ged, it would make it a lot easier for
us to help ya :D

Re: respowning?

PostPosted: Fri Nov 11, 2011 4:39 pm
by hunter84
okay but its basic right now im just trying to get all the controls ready so here it is

practice.ged;.ged

Re: respowning?

PostPosted: Sat Nov 12, 2011 5:20 pm
by RippeR7420
I need the data file in order to view your animations...
You should upload a .zip or a .rar file with all of your files :D

Re: respowning?

PostPosted: Sat Nov 12, 2011 8:05 pm
by hunter84
okay what should i use to zip the folder

Re: respowning?

PostPosted: Sat Nov 12, 2011 8:13 pm
by RippeR7420
I Would use Either Winzip, or Winrar. :)