tutorial_BouncingBall/bball__versions/bball_subVersionsSprites/bball__v05/source/main.c
//-----------------------------------------------------------
// update graphical information (call during vblank)
//-----------------------------------------------------------
update graphical information (call during vblank)
update graphical information ( call during vblank )
void updateGraphics__51Sprites( void )
{
 int n;
 for( n = 0; n < NPILOTETES; n++ )
 {
 sprites[n].attribute[0] = rand() % (192 - 16);
 sprites[n].attribute[1] = (rand() % (256 - 16)) + ATTR1_SIZE_16;
 sprites[n].gfxIndex = tiles_ball;
 sprites[n].palette = (pal_ball << 12);
 }
 ballRender( g_ball, 0, 0 ); 
 REG_BG0HOFS = g_camera_x >> 8;
}
void updateGraphics__51Sprites ( void ) { int n ; for ( n = 0 ; n < NPILOTETES ; n ++ ) { sprites [ n ] . attribute [ 0 ] = rand ( ) % ( 192 - 16 ) ; sprites [ n ] . attribute [ 1 ] = ( rand ( ) % ( 256 - 16 ) ) + ATTR1_SIZE_16 ; sprites [ n ] . gfxIndex = tiles_ball ; sprites [ n ] . palette = ( pal_ball << 12 ) ; } ballRender ( g_ball , 0 , 0 ) ; REG_BG0HOFS = g_camera_x >> 8 ; }
update graphical information (call during vblank)
update graphical information ( call during vblank )
//----------------------------------------------------------- // Ací deuria anar un  //oamUpdate( &oamMain ); /**/ // code to test out the sprite engine // attribute0: set vertical position 0->screen_height-sprite_height, // other default options will be okay (default == zeroed) //sprites[n].attr0 = rand() % (192 - 16); //No! sprites[n].y = rand() % (192 - 16);    // attribute1: set horizontal position 0->screen_width-sprite_width // also set 16x16 size mode //sprites[n].attr1 = (rand() % (256 - 16)) + ATTR1_SIZE_16; // No! sprites[n].x = (rand() % (256 - 16)) + ATTR1_SIZE_16; // attribute0: select tile number and palette number //sprites[n].attr2 = tiles_ball + (pal_ball << 12); //sprites[n].attr2 = tiles_ball + (pal_ball << 12); //sprites[n].attribute[2] = tiles_ball + (pal_ball << 12); /*
 * sprite.h
typedef union SpriteEntry 	SpriteEntry
void 	oamSet (OamState *oam, int id, int x, int y, int priority, int palette_alpha, SpriteSize size, SpriteColorFormat format, const void *gfxOffset, int affineIndex, bool sizeDouble, bool hide, bool hflip, bool vflip, bool mosaic)
 	sets an oam entry to the supplied values More...
 */ // update ball sprite, camera = 0, 0 //ballRender( &g_ball, 0, 0 );        