Added frog as 16x16 sprite instead of being part of background.

This commit is contained in:
Truls Alexander Tangstad 2005-11-09 22:50:12 +00:00
parent 229972274f
commit dc0f14cce8
5 changed files with 18 additions and 9 deletions

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -19,12 +19,13 @@
#include "s_piece_bin.h"
#include "helds_logo_bin.h"
#include "helds_pal_bin.h"
#include "frog_bin.h"
//---------------------------------------------------------------------------------
// storage space for palette data
//---------------------------------------------------------------------------------
u16 PaletteBuffer[256];
OBJATTR sprite;
OBJATTR s_sprite, frog_sprite;
unsigned int frame;
@ -38,9 +39,9 @@ void VblankInterrupt()
void move_show_and_wait(u16 x, u16 y, u16 wait_ticks) {
// assume we are in vblank
sprite.attr1 = OBJ_X(x);
sprite.attr0 = OBJ_256_COLOR | OBJ_Y(y);
CpuFastSet(&sprite, OAM, COPY32 | sizeof(sprite)/4);
s_sprite.attr1 = OBJ_X(x);
s_sprite.attr0 = OBJ_256_COLOR | OBJ_Y(y);
CpuFastSet(&s_sprite, OAM, COPY32 | sizeof(s_sprite)/4);
u16 i;
for (i=0; i<wait_ticks; i++) VBlankIntrWait();
}
@ -63,21 +64,29 @@ int main(void)
REG_IME = 1;
// screen mode, background and objects to display
SetMode( MODE_4 | BG2_ON | OBJ_ON );
SetMode( MODE_4 | BG2_ON | OBJ_ON | OBJ_1D_MAP );
CpuFastSet(helds_logo_bin, (u16*)VRAM, COPY32 | helds_logo_bin_size/4);
CpuFastSet(helds_pal_bin, PaletteBuffer, COPY32 | helds_pal_bin_size / 4);
FadeToPalette( PaletteBuffer, 60);
CpuFastSet(s_piece_bin, BITMAP_OBJ_BASE_ADR, COPY32 | s_piece_bin_size/4);
CpuFastSet(frog_bin, BITMAP_OBJ_BASE_ADR + s_piece_bin_size,
COPY32 | frog_bin_size/4);
CpuFastSet(PaletteBuffer, OBJ_COLORS, COPY32 | sizeof(PaletteBuffer)/4);
memset(&sprite, 0, sizeof(sprite));
sprite.attr2 = OBJ_CHAR(512);
memset(&s_sprite, 0, sizeof(s_sprite));
memset(&frog_sprite, 0, sizeof(frog_sprite));
s_sprite.attr2 = OBJ_CHAR(512);
VBlankIntrWait();
frog_sprite.attr2 = OBJ_CHAR(514);
frog_sprite.attr1 = OBJ_SIZE(1) | OBJ_X(175);
frog_sprite.attr0 = OBJ_256_COLOR | OBJ_Y(49);
CpuFastSet(&frog_sprite, OAM + sizeof(s_sprite), COPY32 | sizeof(frog_sprite)/4);
while (1)
{
VBlankIntrWait();
move_show_and_wait(147, 74, 60);
move_show_and_wait(147, 76, 60);
move_show_and_wait(147, 78, 30);