Move sprite to Andengine

I want to move a sprite to yaxis with some constant speed current. I am only doing a reduction from the height of the screen to 0 with a constant value. here is the code

this.engine.registerDrawHandler(new IDrawHandler() { @Override public void onDraw(GLState pGLState, Camera pCamera) { ballon.setpostiton(ballon.getX(), ballon.getY() - 1); } }); 

But I do not get consistent when I transfer my code to another sprite. On a small device, its ends are earlier compared to higher resolution devices, and on that I went through FillResolutionPolicy in my andengine option more.

Please tell me the consistent way to move the sprite to Andengine.

+4
source share
3 answers
 MoveXModifier mod1=new MoveXModifier(constanttime,fromX,toX); sprite.registerEntityModifier(mod1); 

Use this modifier to move around x.

 MoveYModifier mod1=new MoveYModifier(constanttime,fromY,toY); sprite.registerEntityModifier(mod1); 

Use this modifier to move Y.

 MoveModifier mod1=new MoveModifier(constanttime,fromX,toX,fromY,toY); sprite.registerEntityModifier(mod1); 

Use this modifier to move X and Y.

+9
source

You can take a look at AndEngine Examples β€” especially the Moving Ball Example that you are interested in. You can also download AndEngineExamples from the Play Store to find out what they are doing.

+5
source

Source: https://habr.com/ru/post/1500164/


All Articles