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
|
@ -53,19 +53,38 @@ int main(void)
|
||||||
REG_IME = 1;
|
REG_IME = 1;
|
||||||
|
|
||||||
// screen mode, background and objects to display
|
// screen mode, background and objects to display
|
||||||
SetMode( MODE_4 | BG2_ON | OBJ_ON | OBJ_1D_MAP );
|
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_bin, BITMAP_OBJ_BASE_ADR, COPY32 | car_bin_size/4);
|
||||||
CpuFastSet(car_pal_bin, OBJ_COLORS, COPY32 | car_pal_bin_size/4);
|
CpuFastSet(car_pal_bin, OBJ_COLORS, COPY32 | car_pal_bin_size/4);
|
||||||
|
|
||||||
memset(&car, 0, sizeof(car));
|
memset(&car, 0, sizeof(car));
|
||||||
car.attr2 = OBJ_CHAR(512);
|
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);
|
car.attr0 = OBJ_256_COLOR | OBJ_Y(49);
|
||||||
|
|
||||||
VBlankIntrWait();
|
while (1) {
|
||||||
CpuFastSet(&car, OAM, COPY32 | sizeof(car)/4);
|
if (KeysHeld() & KEY_RIGHT)
|
||||||
while (1) {}
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue