#91233 - Edelnutte - Wed Jul 05, 2006 1:38 pm
hi^^
I want to display and move a sprite using own written funtions, but when I want to Update the OAM it Overwrites every Attribute different and messes up my sprite.
Here are the Funtions for Moving and Updating:
I appreciate any help. I'm pretty new and desperate with it.
I want to display and move a sprite using own written funtions, but when I want to Update the OAM it Overwrites every Attribute different and messes up my sprite.
Here are the Funtions for Moving and Updating:
Code: |
void keyinput(){
u8 x; u8 y; if(!(REG_KEYINPUT & KEY_LEFT)) {x=x-1;} if(!(REG_KEYINPUT & KEY_RIGHT)) {x=x+1;} if(!(REG_KEYINPUT & KEY_A)) {y=y+5;} OAMcopy[0].attr1=OBJ_X(x); OAMcopy[0].attr0=OBJ_Y(y); } |
Code: |
//UPDATE OAM void updateOAM(){ for(i=0;i<128;i++){ OAM[i]=OAMcopy[i];}} |
Code: |
//THE ORIGINAL SPRITE ATTRIBUTES for(i=0;i<128;i++){ OBJ_BASE_ADR[i]=tiles0_Data[i];} OAMcopy[0].attr1=(OBJ_256_COLOR); OAMcopy[0].attr0=(OBJ_SIZE(Sprite_16x16)); OAMcopy[0].attr2=(OBJ_CHAR(0)|OBJ_SQUARE); |
I appreciate any help. I'm pretty new and desperate with it.