trouble with "move to position" attribute please help
rollo
Member Posts: 15
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!
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
-
slowcut Posts: 164... and I don't know how you move your store actor, but if you use the 'move to position' behavior replace it with the 'interpolate' behavior
Answers
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]