Page 1 of 1
3 lifes - how?
Posted:
Tue Jul 17, 2007 3:41 am
by XXGamexGodXX
I want to make the character have three lives and when he gets hit by the enemy he respawns back to the beginning....how can i accomplish this....please help
Posted:
Tue Jul 17, 2007 3:55 am
by pixelpoop
Select your player character
Click on: Add- Collision- Of Actor(enemy name) -Add Action-Script Editor
Click on: Variables -Add -name it something like character_lives.
In the script editor write:
character_lives+=1;
x=0;
y=0;
//change the zeros to equal the x and y positions for the starting point
if (character_lives==3){ DestroyActor("Event Actor"); character_lives=0;}
Posted:
Tue Jul 17, 2007 4:04 am
by XXGamexGodXX
okay....but what i have characters (the lives) and i want them to dissapear one by one eery time he dies..so if he dies...then the first life will be gone...and then if he dies again..then the second life will be gone...and when he dies the third time the third life goes away and then it says game over...could you help me with that?
Posted:
Tue Jul 17, 2007 9:35 am
by pixelpoop
make 3 files all the same size with the lives icons lined up. Name the first file something like lives_icons_00.png and delete all but one of the icons out of it. Now in the second file delete just one of the 3 icons and name it lives_icons_01.png
Now name the 3rd file lives_icons_02.png and leave all the icons in it.
Now add a new actor to the game and name it lives_icon, now add the 3 files as its animations.
Now add an Event:-Create Actor -Script editor
Click on:variables/functions -Change animation -Stopped
Now copy paste this below the line you just created: animpos=2;
Now replace the first script I gave you with this:
lives_icon.animpos-=1;
x=0;
y=0;
//change the zeros to equal the x and y positions for the starting point
if (character_lives==3){ DestroyActor("lives_icon"); character_lives=0; DestroyActor("Event Actor"); }
Posted:
Thu Jul 26, 2007 2:15 am
by arcreamer
um ... WHAT? i did everything u said except that part at the bottom where u said copy and paste the below line u created... um, it threw me off cause i deleted hat i had and pasted it and then it got all screwed and now im lost =(((
Posted:
Thu Jul 26, 2007 2:57 am
by d-soldier
Heres a demo, all you have to do is walk into the lasers and die, observing the "lives icons" deplete, then when none are left, game over. There are numerous ways to accomplish this within GE, this is merely one.
http://game-editor.com/forum/viewtopic. ... 3041#23041