game updates

This commit is contained in:
Lokathor 2023-01-01 18:04:10 -07:00
parent f9fe8b07f7
commit c7ee6ba2ec

View file

@ -26,7 +26,7 @@ struct Rect {
h: u16,
}
impl Rect {
pub fn intersect(self, other: Self) -> bool {
fn intersect(self, other: Self) -> bool {
self.x < other.x + other.w
&& self.x + self.w > other.x
&& self.y < other.y + other.h
@ -51,7 +51,7 @@ extern "C" fn main() -> ! {
creatures[0].x = 11;
creatures[0].y = 14;
//
creatures[1].x = 41;
creatures[1].x = 44;
creatures[1].y = 38;
creatures[2].x = 100;
creatures[2].y = 23;
@ -63,9 +63,9 @@ extern "C" fn main() -> ! {
let mut world = [[0_u8; 32]; 32];
for i in 0..32 {
world[0][i] = b'z';
world[31][i] = b'z';
world[19][i] = b'z';
world[i][0] = b'z';
world[i][31] = b'z';
world[i][29] = b'z';
}
world[1][3] = b'B';
world[2][3] = b'G';
@ -78,12 +78,14 @@ extern "C" fn main() -> ! {
TIMER0_CONTROL.write(TimerControl::new().with_enabled(true));
// bg
BG_PALETTE.index(1).write(Color::MAGENTA);
OBJ_PALETTE.index(1).write(Color::CYAN);
OBJ_PALETTE.index(16 * 1 + 1).write(Color::GREEN);
OBJ_PALETTE.index(16 * 2 + 1).write(Color::RED);
OBJ_PALETTE.index(16 * 3 + 1).write(Color::BLUE);
OBJ_PALETTE.index(16 * 4 + 1).write(Color::YELLOW);
// obj
let colors =
[Color::CYAN, Color::GREEN, Color::RED, Color::BLUE, Color::YELLOW];
for (pal, color) in colors.iter().enumerate() {
obj_palbank(pal).index(1).write(*color);
}
Cga8x8Thick.bitunpack_4bpp(CHARBLOCK0_4BPP.as_region(), 0);
Cga8x8Thick.bitunpack_4bpp(OBJ_TILES.as_region(), 0);