0

I'm newbie in Android and i want start 2D game development. How to change image position? I try this:

  • OpenGL,but it's very complicated for me.I want anything easiser.
  • SetX,Margins,etc.I think this is not real way of development and this is slow.
  • I found some library/game engine for game development,but i don't want to use them.
  • I use animations,but it don't change real position...
Filip
  • 68
  • 10

2 Answers2

0

For a very basic image to move/navigate i think you can use Animation given by android. Under Animation, you have Translate function using which you can translate an image in any direction, only think is you need to take care of the coordinates. Below is an eg code snippet:

Animation animation = new TranslateAnimation(0, 500,0, 0);
animation.setDuration(1000);
animation.setFillAfter(true);
myImage.startAnimation(animation);
myImage.setVisibility(0);

For further details you can visit the post below:

translate animation

Community
  • 1
  • 1
Zax
  • 2,870
  • 7
  • 52
  • 76
  • Yes,i try this but i can't check collision of two imageview. – Filip Aug 12 '13 at 08:25
  • then you need to play with the coordinates of your image and the other image. There in no other simple way to do this. – Zax Aug 12 '13 at 08:35
  • i know this way but i think it's slow?is it? – Filip Aug 12 '13 at 08:39
  • If your images on your screen is static it cannot be slow as you would already know your coordinates. However if it is dynamic, then it will be slow as the coordinates need to be decided / detected during run-time. – Zax Aug 12 '13 at 08:41
0

you can use libgdx,unlike others documentation is available easily and it gives you many features to develop games easily.

Haxor
  • 2,306
  • 4
  • 16
  • 18