Can anybody solve this?
Zwire
Member, PRO Posts: 182
I made a life bar out of 3 hearts, an enemy and player. Every time the player touches the enemy a heart will disappear.
But, in the preview screen, after all the hearts are gone and I press refresh, the game starts again but without the hearts.
How can I let the hearts reset as well?
Via this link you can download the file of the test game i made to see it yourself.
https://www.dropbox.com/s/z75gnxmvahq7883/hearts test.rar?dl=0
If you don't want to sign in: in the bottom you can click "no thanks, continue to download"
Does anyone know a solution?
Comments
I assume you do t have a change attribute to reset the life counter when the scene begins. In an actor, drag a change attribute behavior to the top of the logic stack and change the life actor back to the initial value.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
@Braydon The change attribute is already on top of the logic stack.
What do you mean by change the life actor back to the initial value?
Shouldn't everything be resetted to its former state when you press refresh including your health bar?
I haven't looked at your code, but you need to reset attribute values when you reset a scene or game. For example, if you lives attribute is set to 3 initially, and the game ends when it equals 0, you need to reset your attribute back to 3 when the scene restarts so the player can play again.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
I fixed it with the reset game behavior.
Thank you.