Added nice white background.
Added test of keypresses, moving car to different locations depending on keydirection.
This commit is contained in:
parent
16dbb5a2ed
commit
a179e39eaa
|
@ -55,17 +55,36 @@ int main(void)
|
|||
// screen mode, background and objects to display
|
||||
SetMode( MODE_4 | BG2_ON | OBJ_ON | OBJ_1D_MAP );
|
||||
|
||||
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);
|
||||
CpuFastSet(car_pal_bin, OBJ_COLORS, COPY32 | car_pal_bin_size/4);
|
||||
|
||||
memset(&car, 0, sizeof(car));
|
||||
car.attr2 = OBJ_CHAR(512);
|
||||
car.attr1 = OBJ_SIZE(1) | OBJ_X(175);
|
||||
car.attr1 = OBJ_SIZE(1) | OBJ_X(100);
|
||||
car.attr0 = OBJ_256_COLOR | OBJ_Y(49);
|
||||
|
||||
while (1) {
|
||||
if (KeysHeld() & KEY_RIGHT)
|
||||
car.attr1 = OBJ_SIZE(1) | OBJ_X(172);
|
||||
else if (KeysHeld() & KEY_LEFT)
|
||||
car.attr1 = OBJ_SIZE(1) | OBJ_X(52);
|
||||
else
|
||||
car.attr1 = OBJ_SIZE(1) | OBJ_X(112);
|
||||
|
||||
if (KeysHeld() & KEY_UP)
|
||||
car.attr0 = OBJ_256_COLOR | OBJ_Y(32);
|
||||
else if (KeysHeld() & KEY_DOWN)
|
||||
car.attr0 = OBJ_256_COLOR | OBJ_Y(112);
|
||||
else
|
||||
car.attr0 = OBJ_256_COLOR | OBJ_Y(72);
|
||||
|
||||
VBlankIntrWait();
|
||||
CpuFastSet(&car, OAM, COPY32 | sizeof(car)/4);
|
||||
while (1) {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Reference in New Issue