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 am using "Gdx.input.isTouched()" in the render method of my Screen method, to know where is touched, but when the touch is dragged in the screen, it also activates the events i want only when an actor is touched.

Is there any listener to know when an Actor is touched, but the event is not the dragged one, im doing it with sprites.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

There's a TouchUp and TouchDown method if I'm not mistaken. You need to keep track of state.

I handle this in my projects by creating a custom MyAwesomeSprite class; on TouchDown, I just set _isTouched=true, and on TouchUp, I set _isTouched = false. This allows me to detect dragging (touch-down triggered when _isTouched is already true), so I can easily distinguish between these two cases.

share|improve this answer
    
The touchDown and touchMethod is for the Screen(Stage) right? –  Rudy_TM Feb 11 '12 at 4:33
    
Not sure. I get mine from the Game class, which implements ApplicationListener and InputProcessor –  ashes999 Mar 12 '12 at 3:30
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.