replicate problem

voe513voe513 Member Posts: 10
edited November -1 in Working with GS (Mac)
Hi everyone,

I just finished a tutorial about replicating. TShirtbooth, showed how the replicating is done, but he did not show how the buttons actors (addLife and subtractLife) was coded to increase life by1 and reduce life by 1.

I decide to create two actors, addLife and subtract life.
I made a rule that when mouse button is down on addLife actor, increase the game.life attribute.

that is "change attribute: game.life To : (game.life)+1"
Another rule is when mouse button is down on subtract life actor decrease game.life attribute.

change attribute: game.life To : (game.life)-1

This does not work. I have tried everything that make sense to me. Please suggest an approach. I will really appreciate it.

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    Change it to touch on both actors. If both are mouse down they would fire off at the same time negating each other.
  • voe513voe513 Member Posts: 10
    Thanks jonmulcahy,

    I forgot to include another condition for both actor,

    "actor receive event, mouse position, inside".

    I just went with the default,

    "actor receive event, mouse button, down".

    This was a problem for me and it was really frustrating . But now its figured out, am ready to move to the next tutorial. Thank you so much for the reply.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Just use touch is pressed for each actor. Don't add extra un need code. touches and mouse clicks are interchangeable so just always use touch is pressed for buttons. and you don't need touch is pressed and inside just touch is pressed.

    image
  • voe513voe513 Member Posts: 10
    Ohh, thanks alot tenrdrmer. It works with touch is pressed.
Sign In or Register to comment.