Added a set of chaser sprites to be used for flocking later.
This commit is contained in:
parent
8e32348480
commit
9f4b7c5f76
Binary file not shown.
|
@ -18,14 +18,17 @@
|
|||
//---------------------------------------------------------------------------------
|
||||
#include "car_pal_bin.h"
|
||||
#include "car_bin.h"
|
||||
#include "chaser_bin.h"
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// storage space for palette data
|
||||
//---------------------------------------------------------------------------------
|
||||
u16 PaletteBuffer[256];
|
||||
|
||||
#define NUMCHASERS 10
|
||||
|
||||
// 4 sprites and one
|
||||
OBJATTR oe_buffer[4];
|
||||
OBJATTR oe_buffer[1+NUMCHASERS];
|
||||
OBJAFFINE *const oa_buffer = (OBJAFFINE*)oe_buffer;
|
||||
|
||||
unsigned int frame;
|
||||
|
@ -46,6 +49,8 @@ int main(void)
|
|||
{
|
||||
OBJATTR*car = &oe_buffer[0];
|
||||
OBJAFFINE*car_aff = &oa_buffer[0];
|
||||
// We'll make a few chasers
|
||||
OBJATTR*chasers = &oe_buffer[1];
|
||||
|
||||
// Set up the interrupt handlers
|
||||
InitInterrupt();
|
||||
|
@ -64,8 +69,12 @@ int main(void)
|
|||
u32 white = 0x10101010;
|
||||
CpuFastSet(&white, (void*)VRAM, FILL | 240*160/4);
|
||||
FadeToPalette((void*)car_pal_bin, 1);
|
||||
|
||||
CpuFastSet(car_bin, BITMAP_OBJ_BASE_ADR, COPY32 | car_bin_size/4);
|
||||
|
||||
void* free_space = BITMAP_OBJ_BASE_ADR;
|
||||
CpuFastSet(car_bin, free_space, COPY32 | car_bin_size/4);
|
||||
free_space += car_bin_size;
|
||||
CpuFastSet(chaser_bin, free_space, COPY32 | chaser_bin_size/4);
|
||||
free_space += chaser_bin_size;
|
||||
CpuFastSet(car_pal_bin, OBJ_COLORS, COPY32 | car_pal_bin_size/4);
|
||||
|
||||
car->attr2 = OBJ_CHAR(512);
|
||||
|
@ -78,13 +87,15 @@ int main(void)
|
|||
car_aff->pc = 0;;
|
||||
car_aff->pd = 1 << 8;
|
||||
|
||||
u8 i;
|
||||
for (i=0; i<NUMCHASERS; i++) {
|
||||
chasers[i].attr2 = OBJ_CHAR(520);
|
||||
}
|
||||
|
||||
int x = 112;
|
||||
int y = 72;
|
||||
|
||||
while (1) {
|
||||
int xadjust = 0;
|
||||
int yadjust = 0;
|
||||
|
||||
// This isn't very tidy, but a cleanup is always
|
||||
// imminent...
|
||||
|
||||
|
@ -140,11 +151,16 @@ int main(void)
|
|||
else if (KeysHeld() & KEY_DOWN)
|
||||
y += 1;
|
||||
|
||||
car->attr1 = OBJ_SIZE(1) | OBJ_X(x+xadjust);
|
||||
car->attr0 = OBJ_256_COLOR | OBJ_DOUBLE | OBJ_ROT_SCALE_ON | OBJ_Y(y+yadjust);
|
||||
car->attr1 = OBJ_SIZE(1) | OBJ_X(x);
|
||||
car->attr0 = OBJ_256_COLOR | OBJ_DOUBLE | OBJ_ROT_SCALE_ON | OBJ_Y(y);
|
||||
|
||||
for (i=0; i<NUMCHASERS; i++) {
|
||||
chasers[i].attr1 = OBJ_X(x-(8*i));
|
||||
chasers[i].attr0 = OBJ_256_COLOR | OBJ_Y(y-(8*i));
|
||||
}
|
||||
|
||||
VBlankIntrWait();
|
||||
CpuFastSet(oa_buffer, OAM, COPY32 | sizeof(OBJAFFINE)/4);
|
||||
CpuFastSet(oe_buffer, OAM, COPY32 | sizeof(oe_buffer)/4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue