GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Can anybody solve this?

ZwireZwire Posts: 165Member, BASIC

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

  • Braydon_SFXBraydon_SFX Posts: 8,966Member, Sous Chef, PRO, Bowlboy Sidekick GameSalad Employee

    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.

  • ZwireZwire Posts: 165Member, BASIC

    @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?

  • Braydon_SFXBraydon_SFX Posts: 8,966Member, Sous Chef, PRO, Bowlboy Sidekick GameSalad Employee

    @Zwire said:
    @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.

  • ZwireZwire Posts: 165Member, BASIC

    I fixed it with the reset game behavior.

    Thank you.

Sign In or Register to comment.