Friday, 15 August 2014

java - libGDX How to match user click to object position? -



java - libGDX How to match user click to object position? -

i'm trying develop own game next kilobolt.com tutorial , altering i'm trying create, found myself in pickle...

a bit of background: in zombie bird tutorial, within bird object there onclick() method beingness called within touchdown() method of different class implement inputprocessor. when game run , user tap screen, bird react going bit.

what want know: seek create bit more detailed, require user tap exact position of bird on screen while moves, , every time bird beingness tapped, calls animation.

i tried few codes found in google , modified them when did not work, game crashed.

being new game developing inquire of please bare incompetence.

i create 2 circle objects libgdx's circle class. 1 circle follow bird on screen, while other 1 positioned based on user touches screen. if statement like:

if(user.getcircle().intersects(bird.getcircle()) && screen.istouched()) animation();

not complicated, not best way implement, it's something.

java android libgdx

No comments:

Post a Comment