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

  • tatiangtatiang Posts: 11,949
    edited November 2014 Accepted Answer

    Try this:

    Change attribute game.newX (real) to self.position.X
    Change attribute game.newY (real) to self.position.Y

    If 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.newY

    If 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

  • jsorr2jsorr2 Member Posts: 279

    upload your project. you cant just say "i have code thats not working, what do i do?" and not show us your code.

  • tjunchyetjunchye Member Posts: 2

    Thanks Tatiang! I'll try this out and see.

  • tjunchyetjunchye Member Posts: 2

    Hi Tatiang! It worked! Thanks a lot for the solution!

Sign In or Register to comment.