質問

I need to know how to reset the SneakyJoyStick back to its original centered position. The problem that I'm having is I have the joystick controlling my player and when the player reaches a door tile on a TMX map I have it push the new scene/map, problem occurs when I try to leave the new scene/map because when I pop the scene (to get back to the first scene) the joystick is still stuck in the direction of the door so it pushes me in again so I essentially cannot leave the room. I think it has something to do with the fact that thats where I was last touching the screen so maybe I need to clear touches or something?

役に立ちましたか?

解決

I found a workaround if others had the same question, in SneakyJoystick.h if you change @property (nonatomic, readonly) CGPoint velocity; to @property (nonatomic, readwrite) CGPoint velocity; then you can JoyStickName.velocity = CGPointZero; to reset the velocity. Changing @property (nonatomic, readonly) CGPoint stickPosition; in SneakyJoystick.h to @property (nonatomic, readwrite) CGPoint stickPosition; then using JoyStickName.stickPosition = CGPointZero; will reset the actual 'stick' image.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top