java - Moving object when is touched -


i use code move object:

 if (gdx.input.istouched())     {                      gameobject1.y=gdx.graphics.getheight()-gdx.input.gety() + 30;                      gameobject1.x=gdx.input.getx() + 30;        } 

but in case, object move when screen touched. in libgdx simple way move object when object clickedd/pressed? code above?

the simple way use scene2d this. has hit detection feature, based on event system can use attaching listeners actors.

another way use intersector in combination rectangle bounding box , hit detection yourself.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -