Questions about actor movement
Hi guys,
I'm having a movement problem with my current project. I spent the whole day trying to look for the solution in the forums however I couldn't find any. So I hope if you guys can help me. Here is the situation...
I created an invisible touch movement actor on the left side and right side. So when the touch of the actor is released, the hero actor will move to the spot where the touch was released. The problem lies when the hero is moving. If the touch movement is pressed (not released) again, the hero actor will move to the new position. Is there a way to make the hero actor completing it's action before doing a new action?
I'm using 'Interpolate' for the movement.
Thanks in advance!
Best Answer
-
tatiang Posts: 11,949
Try this:
Change attribute game.newX (real) to self.position.X
Change attribute game.newY (real) to self.position.YIf touch is pressed AND attribute self.position.X=game.newX AND attribute self.position.Y=game.newY
Change attribute game.newX to game.mouse.position.X
Change attribute game.newY to game.mouse.position.Y
Interpolate self.position.X to game.newX
Interpolate self.position.Y to game.newYIf you're using touch positions instead of mouse positions, just substitute them above.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
upload your project. you cant just say "i have code thats not working, what do i do?" and not show us your code.
Thanks Tatiang! I'll try this out and see.
Hi Tatiang! It worked! Thanks a lot for the solution!