-
barabasandras1Likes 0Problem Description
My question is what is the best way to implement the movement for a sprite. It should behave like: when you touch the screen on a certain point the sprite will go there in n second it doesnt matter now. But if you keep touching (onTouchMoved?) the screen, it should follow your finger always. I made an action MoveTo with the touch.getLocation parameters but it keeps bouncing so its shitty as hell.
-
Sonar Systems adminLikes 0
Could you show us a video of what happens please.
-
barabasandras1Likes 0
Sorry, I can’t. I try to explain it.
Make a sprite, then create a new event listener where you are listening the main layer. When you’re moving your finger the screen, the sprite you created should follow it by an action you trigger every time the event happens. The action is MoveTo(). That’s it. It will go crazy.
I just want this simple thing. The sprite should follow my finger on the screen :)
-
Sonar Systems adminLikes 0
Have you cancelled all previous actions to prevent multiple from occuring at the same time?
-
barabasandras1Likes 0
No I haven’t. Do you think this would be the problem here?
-
Sonar Systems adminLikes 0
yh
check this link out http://discuss.cocos2d-x.org/t/how-do-i-cancel-my-move-action-if-another-starts/1132/2
-
barabasandras1Likes 0
I will check it out. Thanks in advance! :D You’re a life saver guys rly
This reply has been verified.
-
Sonar Systems adminLikes 1
:D
-
barabasandras1Likes 1
Well :D its not bugging/bouncing anymore but still it doesnt follow my finger :( only when i stop touching the screen
All right I managed to solve this by making a simple solution: i just use sprite.setPosition() when I call the onTouchMoved :D No need to use any actions if i want it to follow my touch...This reply has been verified.
-
Sonar Systems adminLikes 1
Great to hear you have it solved :D
Login to reply