Ok, so you don't have any life mechanism in your game. Your first post sounded like you did have an hp variable setup. As for the tutorials, a lot of them are messed up, and akr did release a version where we could create our own (but it hasn't worked for me yet). Just to note, even those fluent in English (as a first language) still don't necessarily have great spelling or grammar. Though it is true the gE community is very diverse.
For the most part, from what it sounds like you are doing, this should work. Add the death animation to the actor you want to disappear. On the collision event where you were putting the CreateActor code, put a ChangeAnimation call to set the death animation. Also call ChangePath there as well.
player -> Collision with Bullet (disabled) -> Script Editor
- Code: Select all
ChangeAnimation("Event Actor", "death", FORWARD);
ChangePath("Event Actor", "deathPath", BOTH_AXIS);
player -> Path Finish (deathPath) -> Script Editor
- Code: Select all
DestroyActor("Event Actor");
The most important thing to know is how to use variables. To put it in overly simple (but effective) terms, a variable is a number. In script you can access this number whenever you want. You can change it and use it for comparisons. So, in your case you want to have a lives variable. To gameEditor, the variable will always be there and you can use it to tell gE what to do. I think this link adequately describes how to make a variable. If not, do tell me and I'll fix it.
http://game-editor.com/Creating_variablesWhen you have created the lives variable, you can set how many lives the player gets. I put the script in the view's create actor, so it happens each time you load the game.
view -> Create Actor -> Script Editor
- Code: Select all
lives=3;
Now, if you want to make the player lose a life (for example hitting a projectile), just lower the variable by 1.
player -> Collision with Bullet (disabled) -> Script Editor
- Code: Select all
lives=lives-1;
If you want to check if the player has no more lives, and if so end the game, add this code.
player -> Collision with Bullet (disabled) -> Script Editor
- Code: Select all
lives--; // same as the lives=lives-1; code
if(lives<=0) // if lives is less than or equal to zero execute the code inside the { }
{
ExitGame(); // quits the game
}
So you know, the // comments the code, meaning gE will ignore any code after the //, so you can write notes to explain what you are doing. Anyway that is a quick description, I can pm you a more in depth version if you want. I'm working on improving the wiki, among other things, so I like getting as much input from new users about what needs to be improved as I can.