GameSalad

Howdy, Stranger!

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

trouble with "move to position" attribute please help

rollorollo Posts: 15Member
Hi there,
So I am creating a store that slides out when a button is pressed and then slides back in when the button is pressed again. So when the button is pressed the store actor slides out to its position on the screen, which is what I want it to do, but sometimes when the button is pressed it moves past its position and off of the screen. I want my game to be seamless so I cant have it only working half of the time. If you know how to fix this please comment. thanks!

Best Answer

Answers

  • slowcutslowcut Posts: 164Member, PRO
    Hi, do the following:

    create an index attribute call it as you like, maybe: game.door.

    In your button create a rule
    If touch ist pressed
    Change attribute game.door to mod(game.door+1,2) [use the expressioneditor]

    In your door actor create a rule
    If game.door = 0 [insert your door close behaviors]
    If game.door = 1 [insert your door open behaviors]
  • rollorollo Posts: 15Member
    Thanks that fixed it!
Sign In or Register to comment.