tangstad/helds
tangstad
/
helds
Archived
1
0
Fork 0

Added animated turret sprite.

This commit is contained in:
Truls Alexander Tangstad 2005-11-13 18:15:07 +00:00
parent 1a2745f7a8
commit abd3ed414f
5 changed files with 52 additions and 17 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -20,12 +20,13 @@
#include "helds_logo_bin.h"
#include "helds_pal_bin.h"
#include "frog_bin.h"
#include "turret_bin.h"
//---------------------------------------------------------------------------------
// storage space for palette data
//---------------------------------------------------------------------------------
u16 PaletteBuffer[256];
OBJATTR s_sprite, frog_sprite;
OBJATTR s_sprite, frog_sprite, turret_sprite;
unsigned int frame;
@ -46,6 +47,27 @@ void move_show_and_wait(u16 x, u16 y, u16 wait_ticks) {
for (i=0; i<wait_ticks; i++) VBlankIntrWait();
}
void move_turret(u16 frame_delay) {
// assume we are in vblank
s8 pos;
u16 i;
for (pos=0; pos<5; pos++) {
turret_sprite.attr2 = OBJ_CHAR(522 + pos*8);
CpuFastSet(&turret_sprite, OAM + sizeof(s_sprite) + sizeof(frog_sprite),
COPY32 | sizeof(turret_sprite)/4);
for (i=0; i<frame_delay; i++) VBlankIntrWait();
}
for (pos=4; pos>=0; pos--) {
turret_sprite.attr2 = OBJ_CHAR(522 + pos*8);
CpuFastSet(&turret_sprite, OAM + sizeof(s_sprite) + sizeof(frog_sprite),
COPY32 | sizeof(turret_sprite)/4);
for (i=0; i<frame_delay; i++) VBlankIntrWait();
}
}
//---------------------------------------------------------------------------------
// Program entry point
//---------------------------------------------------------------------------------
@ -73,29 +95,42 @@ int main(void)
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(turret_bin, BITMAP_OBJ_BASE_ADR + s_piece_bin_size + frog_bin_size,
COPY32 | turret_bin_size/4);
CpuFastSet(PaletteBuffer, OBJ_COLORS, COPY32 | sizeof(PaletteBuffer)/4);
memset(&s_sprite, 0, sizeof(s_sprite));
memset(&frog_sprite, 0, sizeof(frog_sprite));
memset(&turret_sprite, 0, sizeof(turret_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);
turret_sprite.attr2 = OBJ_CHAR(516);
turret_sprite.attr1 = OBJ_SIZE(1) | OBJ_X(43);
turret_sprite.attr0 = OBJ_256_COLOR | OBJ_Y(73);
VBlankIntrWait();
CpuFastSet(&frog_sprite, OAM + sizeof(s_sprite), COPY32 | sizeof(frog_sprite)/4);
while (1)
{
move_show_and_wait(147, 74, 60);
move_show_and_wait(147, 76, 60);
move_show_and_wait(147, 78, 30);
move_show_and_wait(145, 78, 30);
move_show_and_wait(145, 80, 60);
move_show_and_wait(145, 82, 60);
move_show_and_wait(145, 84, 60);
move_show_and_wait(145, 86, 60);
move_show_and_wait(145, 88, 180);
move_turret(3);
move_turret(3);
move_turret(3);
move_turret(3);
move_show_and_wait(147, 74, 30);
move_show_and_wait(147, 76, 30);
move_show_and_wait(147, 78, 15);
move_show_and_wait(145, 78, 15);
move_show_and_wait(145, 80, 30);
move_show_and_wait(145, 82, 30);
move_show_and_wait(145, 84, 30);
move_show_and_wait(145, 86, 30);
move_show_and_wait(145, 88, 30);
}
}