I'm currently working on a game where the player takes 3 hits to kill him and end the game.
So logically, I set up a variable for health called "health" and se it's starting value to 3.
Then I set up the code to play the death animations when the player is killed. This is currently in the Room_load funtion
Code: ags
Then, there's three events controlling when the player gets damaged.
This is when a bowling ball lands on his head.
Code: ags
This is when he gets a door slammed on him.
Code: ags
And finally, when he gets hit in the head with a flower pot.
Code: ags
Despite executing all 3 of these events perfectly in the game, The death animation doesn't happen. Thanks for all the help you guys!
So logically, I set up a variable for health called "health" and se it's starting value to 3.
Then I set up the code to play the death animations when the player is killed. This is currently in the Room_load funtion
if (health == 0)
{
player.ChangeView(1);
player.Animate(2, 5, eRepeat, eNoBlock);
Wait(50);
aScream.Play(eAudioPriorityHigh, eOnce);
player.Animate(1, 5, eRepeat, eBlock);
}
Then, there's three events controlling when the player gets damaged.
This is when a bowling ball lands on his head.
if (player.IsCollidingWithObject(oObject1))
{
player.StopMoving();
aRambling_ball.Stop();
oObject1.Visible = false;
player.ChangeView(8);
player.Animate(0, 5, eOnce, eBlock);
health -= 1;
oinactiveball.Visible = true;
Wait(100);
player.ChangeView(4);
ctalk.Walk(2241, 143, eNoBlock, eAnywhere);
}
This is when he gets a door slammed on him.
if ((atshop == true) && (running == true))
{
aAccounting2.Stop();
player.ChangeView(8);
player.Animate(1, 5, eOnce, eBlock, eForwards);
player.ChangeView(7);
player.Animate(3, 5, eOnce, eBlock);
Wait(100);
player.ChangeView(4);
health -= 1;
ctalk.Walk(3290, 143, eNoBlock, eAnywhere);
}
And finally, when he gets hit in the head with a flower pot.
if (player.IsCollidingWithObject(oactivepot))
{
player.StopMoving();
aAccounting2.Stop();
oactivepot.Visible = false;
player.ChangeView(8);
player.Animate(0, 5, eOnce, eBlock);
obrokepot.Visible = true;
Wait(100);
player.ChangeView(4);
health -= 1;
ctalk.Walk(3290, 143, eNoBlock, eAnywhere);
}
Despite executing all 3 of these events perfectly in the game, The death animation doesn't happen. Thanks for all the help you guys!
