respawn

Non-platform specific questions.

respawn

Postby hunter84 » Wed May 30, 2012 9:07 pm

ive tried to get my character to respawn when he is shot and dies but i cant figure it out. can anyone help?
If two wrongs don't make a right, try three.
Work in progress:
viewtopic.php?f=4&t=12888

Finished work:
Space Adventures- Lost In Space viewtopic.php?f=4&t=12587
User avatar
hunter84
 
Posts: 132
Joined: Thu Nov 10, 2011 12:13 am
Location: Yukon, Canada
Score: 3 Give a positive score

Re: respawn

Postby skydereign » Wed May 30, 2012 9:24 pm

We'll need to know a bit more about your setup. I tried to explain to you yesterday that unless we have your game in front of us (the ged and data) we can't actually give you a complete answer. I told you how to respawn the player actor when it gets hit by the bullet. You mentioned it didn't work, but I think the problem is that the view didn't move to where you recreated the player, or you recreated the player in the wrong spot. So, for instance if you wanted the player to respawn in the center of the view, you could use this.
Code: Select all
CreateActor("player", "stand_right", "(none)", "(none)", view.x+view.width/2, view.y+view.height/2, true);

That should work unless you have the view parented to the player.
User avatar
skydereign
 
Posts: 3461
Joined: Mon Jul 28, 2008 8:29 am
Score: 570 Give a positive score

Re: respawn

Postby hunter84 » Fri Jun 01, 2012 3:50 am

i have. im not good with regions
If two wrongs don't make a right, try three.
Work in progress:
viewtopic.php?f=4&t=12888

Finished work:
Space Adventures- Lost In Space viewtopic.php?f=4&t=12587
User avatar
hunter84
 
Posts: 132
Joined: Thu Nov 10, 2011 12:13 am
Location: Yukon, Canada
Score: 3 Give a positive score

Re: respawn

Postby Chai » Fri Jun 01, 2012 4:34 am

When your character die created another actor as timer for respawn your character.

for the code as manual timer
Code: Select all
if(var1>=60){createdActor...Your player Actor name....; DestroyActor(); }else{ var1++; }


don't forget to set timer actor transparency to be 0.99.
User avatar
Chai
 
Posts: 361
Joined: Sat Apr 30, 2005 2:26 pm
Location: Thailand
Score: 30 Give a positive score

Re: respawn

Postby hunter84 » Fri Jun 01, 2012 3:34 pm

ok i cant fix it so here is the ged.
Attachments
data.zip
(654.86 KiB) Downloaded 17 times
If two wrongs don't make a right, try three.
Work in progress:
viewtopic.php?f=4&t=12888

Finished work:
Space Adventures- Lost In Space viewtopic.php?f=4&t=12587
User avatar
hunter84
 
Posts: 132
Joined: Thu Nov 10, 2011 12:13 am
Location: Yukon, Canada
Score: 3 Give a positive score

Re: respawn

Postby skydereign » Fri Jun 01, 2012 5:25 pm

Ok, the first thing is you don't even have the create actor function call anymore. So, you aren't recreating the player at all. Next is when you do recreate the actor, you need to reparent the view to the player (since the player actor it was parented to was destroyed). To do this you can call the ChangeParent function, setting the view's parent to player.

Lastly, you'll need to move the view to wherever you respawn the player. Since you have now parented the view to the player, its coordinates are relative to the player, so all you need to do is set the view's x and y equal to (-300, -350).
Code: Select all
view.x=-300;
view.y=-250;


And all of that goes into the event you called DestroyActor.
User avatar
skydereign
 
Posts: 3461
Joined: Mon Jul 28, 2008 8:29 am
Score: 570 Give a positive score

Re: respawn

Postby hunter84 » Fri Jun 01, 2012 5:37 pm

ok well since youve seen the begginning of the game what do you think?
If two wrongs don't make a right, try three.
Work in progress:
viewtopic.php?f=4&t=12888

Finished work:
Space Adventures- Lost In Space viewtopic.php?f=4&t=12587
User avatar
hunter84
 
Posts: 132
Joined: Thu Nov 10, 2011 12:13 am
Location: Yukon, Canada
Score: 3 Give a positive score

Re: respawn

Postby DarkParadox » Fri Jun 01, 2012 7:03 pm

The problem was resolved/fixed/whatever you would like to say in the game-editor.net chatroom ( http://game-editor.net/index.php/chatroom ).

No need to worry about it anymore.
~Woo
◄Lurker Coder►
◄Black Hole of Codes (GUI API & More)►
◄GE's keywords and operators and how to use them►
Please excuse stupidity in my older posts, I was an internet newbie!
User avatar
DarkParadox
 
Posts: 456
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score

Re: respawn

Postby hunter84 » Fri Jun 01, 2012 7:07 pm

thanks again dark
If two wrongs don't make a right, try three.
Work in progress:
viewtopic.php?f=4&t=12888

Finished work:
Space Adventures- Lost In Space viewtopic.php?f=4&t=12587
User avatar
hunter84
 
Posts: 132
Joined: Thu Nov 10, 2011 12:13 am
Location: Yukon, Canada
Score: 3 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest