android - AnimatedSprite displays with wrong size -


sorry if problem asked before. have searched around didn't find thread this, post question here.

i new on andengine. trying load tiled sprite , create animation it. here codes:

public void loadgameresources() {     bitmaptextureatlastextureregionfactory.setassetbasepath("gfx/player/");     msapotextureatlas = new bitmaptextureatlas(mactivity.gettexturemanager(),256,178,textureoptions.default);     mplayerdownitiledtextureregion = bitmaptextureatlastextureregionfactory.createtiledfromasset(mplayertextureatlas, mactivity.getassets(), "player.png", 0,0,3,1);     mplayertextureatlas.load();  } 

what expect player can actions walking don't. please see attached screenshots see real result. think codes split original texture 3 parts rather split 3 sprites @ first row.

please take , me fix this. lot!

enter image description here enter image description here enter image description here enter image description here , here how create animation:

animatedsprite player= new animatedsprite(100,100,40,40,mresourcemanager.mplayerdownitiledtextureregion,mvertexbufferobjectmanager); player.animate(500); player.setzindex(100); attachchild(sapo); 

what understood want animate player in each direction properly. that

according library method

bitmaptextureatlastextureregionfactory.createtiledfromasset(pbitmaptextureatlas, passetmanager, passetpath, ptexturex, ptexturey, ptilecolumns, ptilerows);

your code change below

msapotextureatlas = new bitmaptextureatlas(mactivity.gettexturemanager(),256,256,textureoptions.default); mplayerdownitiledtextureregion = bitmaptextureatlastextureregionfactory.createtiledfromasset(mplayertextureatlas, mactivity.getassets(), "player.png", 0,0,3,4); 

to animate player in different directions use technique define array as

long[] animate_duration = new long[] { 200, 200, 200 };  animatedsprite player = new animatedsprite(x, y, this.mplayertextureregion,this.getvertexbufferobjectmanager());    // down player.animate(animate_duration, 0, 2, true); // player.animate(animate_duration, 9, 11, true); // right player.animate(animate_duration, 6, 8, true); // left player.animate(animate_duration, 3, 5, true); 

look example more information.

if have doubt ask me. hope helped!


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -