Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 3
Registered: ‎01-10-2013
My Device: Curve 8520
My Carrier: o2

Detecting up, down, left, right Navigation Movement for game

Okay, I need to know if the user has moved the trackwheel down, left, up or right and then be able to move an image in accordance with the direction the user has moved the trackwheel.

 

how can i use navigationMovement() to do this, or is there a different way?

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Detecting up, down, left, right Navigation Movement for game

welcome to the support forums.

yes, this is the appropriate method.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Contributor
Posts: 3
Registered: ‎01-10-2013
My Device: Curve 8520
My Carrier: o2

Re: Detecting up, down, left, right Navigation Movement for game

yes but how do i detect if it is being moved to the left and how would I change a boolean using this code?

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Detecting up, down, left, right Navigation Movement for game

dx will be begative for left and postive for right.

 

Does that answer your question?

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Detecting up, down, left, right Navigation Movement for game

You have dx and dy as parameters there. dx < 0 is moving left; dx > 0 is moving right; dy > 0 is moving down (yes, down is the positive direction); dy < 0 is moving up.

 

The absolute values of dx and dy are usually 0 or 1, but sometimes quick swipes on the touchpad will generate bigger movements. It is also very rare that both dx and dy are non-zero, but it might happen on fast diagonal swipes.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
New Contributor
Posts: 3
Registered: ‎01-10-2013
My Device: Curve 8520
My Carrier: o2

Re: Detecting up, down, left, right Navigation Movement for game

Thanks, that helps so much Smiley Happy