Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm looking to be able to drag a sprite that is currently on a path from a path modifier. Currently, I have sprites on a path, and I have stationary sprites that are draggable. However, simply overriding the sprite's onAreaTouched doesn't work until the sprite completes its path. How would I do this?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

I see those possibilities:

  • you could call clearEntityModifiers(); in the onAreaTouched of your sprite. This will kill all modifiers you registered to the sprite (so your pathmodifier but also any AlphaModifier or else).
  • or you can call unregisterEntityModifier( yourPathModifier );

hope this helps. regards

Christoph

share|improve this answer
    
I put a Log.i inside the onAreaTouched event and nothing registers until after the path is clear. So trying to call those methods will not work. My only thought right now is to add a transparent sprite over-top of the path modified sprite (which updates with the game loop) to utilize its onAreadTouch but this seems very clunky.... –  Brandon Jan 31 '13 at 18:22
    
that's odd... maybe there is something else blocking the onAreaTouched. It is definitely possible to touch a sprite when it is moving and to kill the modifier at any time – I did it before, although I didn't make the sprite draggable like you do. But that shouldn't be the point. Maybe you can add code to the post, like for example your onAreaTouched and the part where you create the PathModifier. –  Christoph Gerstner Jan 31 '13 at 22:20
    
It was my mistake, I added the Log.i to the wrong onAreaTouched. This did work, thanks! –  Brandon Feb 1 '13 at 18:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.