changed little things in the arduboy-rust crate & added gamelogic of drboy
This commit is contained in:
parent
ae84c66d13
commit
6be633cc9b
10 changed files with 340 additions and 86 deletions
BIN
Examples/drboy/assets/Ingame-overlay.aseprite
Normal file
BIN
Examples/drboy/assets/Ingame-overlay.aseprite
Normal file
Binary file not shown.
BIN
Examples/drboy/assets/Ingame-overlay1.png
Normal file
BIN
Examples/drboy/assets/Ingame-overlay1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 192 B |
BIN
Examples/drboy/assets/Ingame-overlay2.png
Normal file
BIN
Examples/drboy/assets/Ingame-overlay2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 211 B |
BIN
Examples/drboy/assets/Ingame-overlay3.png
Normal file
BIN
Examples/drboy/assets/Ingame-overlay3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 204 B |
BIN
Examples/drboy/assets/Titlescreen.aseprite
Normal file
BIN
Examples/drboy/assets/Titlescreen.aseprite
Normal file
Binary file not shown.
BIN
Examples/drboy/assets/Titlescreen.png
Normal file
BIN
Examples/drboy/assets/Titlescreen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 592 B |
118
Examples/drboy/src/gameloop.rs
Normal file
118
Examples/drboy/src/gameloop.rs
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
pub unsafe fn gameloop() {
|
||||||
|
arduboy.set_cursor(70, 0);
|
||||||
|
arduboy.print(get_string_addr!(overlay_score));
|
||||||
|
arduboy.print(p.counter as i16);
|
||||||
|
match p.live {
|
||||||
|
3 => sprites::draw_override(0, 0, get_sprite_addr!(overlay_3hearts), 0),
|
||||||
|
2 => sprites::draw_override(0, 0, get_sprite_addr!(overlay_2hearts), 0),
|
||||||
|
1 => sprites::draw_override(0, 0, get_sprite_addr!(overlay_1heart), 0),
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
if p.active {
|
||||||
|
sprites::draw_override(p.rect.x, p.rect.y, p.bitmap, p.bitmap_frame as u8);
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.immortal {
|
||||||
|
p.immortal_frame_count += 1;
|
||||||
|
if arduboy.every_x_frames(10) {
|
||||||
|
p.active = !p.active
|
||||||
|
}
|
||||||
|
if p.immortal_frame_count == 60 {
|
||||||
|
p.immortal_frame_count = 0;
|
||||||
|
p.immortal = false;
|
||||||
|
p.active = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vec_enemies.iter_mut().for_each(|f| {
|
||||||
|
if f.active {
|
||||||
|
sprites::draw_override(f.rect.x * 8, f.rect.y * 8, f.bitmap, f.bitmap_frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
if arduboy.every_x_frames(p.speed as u8) && f.active {
|
||||||
|
f.move_down();
|
||||||
|
if f.rect.x < 0 {
|
||||||
|
f.active = false;
|
||||||
|
p.live -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let frect = Rect {
|
||||||
|
x: f.rect.x * 8,
|
||||||
|
y: f.rect.y * 8,
|
||||||
|
width: 8,
|
||||||
|
height: 8,
|
||||||
|
};
|
||||||
|
if !p.immortal && f.active {
|
||||||
|
if arduboy.collide_rect(p.rect, frect) {
|
||||||
|
if p.bitmap_frame as u8 == f.bitmap_frame {
|
||||||
|
f.active = false;
|
||||||
|
p.speed_change = false;
|
||||||
|
p.counter += 1;
|
||||||
|
} else {
|
||||||
|
p.live -= 1;
|
||||||
|
p.immortal = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if arduboy.every_x_frames((p.speed * 2) as u8) && enemy_count < 30 {
|
||||||
|
vec_enemies
|
||||||
|
.push(Enemy {
|
||||||
|
active: true,
|
||||||
|
bitmap: get_sprite_addr!(enemies),
|
||||||
|
bitmap_frame: random_less_than(3) as u8,
|
||||||
|
rect: Rect {
|
||||||
|
x: random_between(15, 16) as i16,
|
||||||
|
y: random_between(1, 8) as i16,
|
||||||
|
width: 8,
|
||||||
|
height: 8,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
enemy_count += 1
|
||||||
|
}
|
||||||
|
if p.live == 0 {
|
||||||
|
p.gamemode = GameMode::Losescreen;
|
||||||
|
}
|
||||||
|
arduboy.poll_buttons();
|
||||||
|
if arduboy.pressed(UP) {
|
||||||
|
if p.rect.y > 7 {
|
||||||
|
p.rect.y -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if arduboy.pressed(DOWN) {
|
||||||
|
if p.rect.y < 56 {
|
||||||
|
p.rect.y += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if arduboy.pressed(LEFT) {
|
||||||
|
if p.rect.x > 0 {
|
||||||
|
p.rect.x -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if arduboy.pressed(RIGHT) {
|
||||||
|
if p.rect.x < 120 {
|
||||||
|
p.rect.x += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if arduboy.just_pressed(A) {
|
||||||
|
p.bitmap_frame += 1;
|
||||||
|
if p.bitmap_frame > 2 {
|
||||||
|
p.bitmap_frame = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if arduboy.just_pressed(B) {
|
||||||
|
p.bitmap_frame -= 1;
|
||||||
|
if p.bitmap_frame < 0 {
|
||||||
|
p.bitmap_frame = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if p.counter % 5 == 0 && p.counter != 0 && !p.speed_change {
|
||||||
|
p.speed_change = true;
|
||||||
|
p.speed -= 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
progmem!();
|
|
@ -4,59 +4,71 @@
|
||||||
//Include the Arduboy Library
|
//Include the Arduboy Library
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use arduboy_rust::prelude::*;
|
use arduboy_rust::prelude::*;
|
||||||
|
mod gameloop;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
const arduboy: Arduboy2 = Arduboy2::new();
|
pub const arduboy: Arduboy2 = Arduboy2::new();
|
||||||
|
|
||||||
// Progmem data
|
|
||||||
// 8x16
|
|
||||||
|
|
||||||
progmem!(
|
|
||||||
pub static pills: [u8; _] = [
|
|
||||||
// width, height,
|
|
||||||
8, 8, 0x7e, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x7e, // TILE 00
|
|
||||||
0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7e, // TILE 01
|
|
||||||
0x7e, 0xd5, 0xab, 0xd5, 0xab, 0xd5, 0xab, 0x7e, // TILE 02
|
|
||||||
];
|
|
||||||
pub static enemies: [u8; _] = [
|
|
||||||
8, 8, // width, height,
|
|
||||||
0xa3, 0x51, 0xa6, 0x51, 0xa1, 0x56, 0xa1, 0x53, // TILE 00
|
|
||||||
0x7e, 0xdf, 0xb3, 0xdf, 0xbf, 0xd3, 0xbf, 0x7e, // TILE 01
|
|
||||||
0x7e, 0xc1, 0xad, 0xc1, 0xa1, 0xcd, 0xa1, 0x7e, // TILE 02
|
|
||||||
];
|
|
||||||
);
|
|
||||||
// dynamic ram variables
|
// dynamic ram variables
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Player {
|
pub struct Enemy {
|
||||||
bitmap: *const u8,
|
pub active: bool,
|
||||||
bitmap_frame: u8,
|
pub bitmap: *const u8,
|
||||||
x: i16,
|
pub bitmap_frame: u8,
|
||||||
y: i16,
|
pub rect: Rect,
|
||||||
}
|
|
||||||
#[derive(Debug)]
|
|
||||||
struct Enemy {
|
|
||||||
bitmap: *const u8,
|
|
||||||
bitmap_frame: u8,
|
|
||||||
x: i16,
|
|
||||||
y: i16,
|
|
||||||
}
|
}
|
||||||
impl Enemy {
|
impl Enemy {
|
||||||
fn move_down(&mut self) {
|
pub fn move_down(&mut self) {
|
||||||
self.x -= 1;
|
self.rect.x -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static mut p: Player = Player {
|
#[derive(Debug)]
|
||||||
bitmap: get_sprite_addr!(enemies),
|
pub struct Player {
|
||||||
|
pub gamemode: GameMode,
|
||||||
|
pub immortal: bool,
|
||||||
|
pub immortal_frame_count: u8,
|
||||||
|
pub active: bool,
|
||||||
|
pub live: u8,
|
||||||
|
pub speed: u8,
|
||||||
|
pub speed_change: bool,
|
||||||
|
pub counter: u8,
|
||||||
|
pub bitmap: *const u8,
|
||||||
|
pub bitmap_frame: i8,
|
||||||
|
pub rect: Rect,
|
||||||
|
pub gameover_height: i16,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub static mut p: Player = Player {
|
||||||
|
gamemode: GameMode::Titlescreen,
|
||||||
|
live: 3,
|
||||||
|
immortal: false,
|
||||||
|
immortal_frame_count: 0,
|
||||||
|
active: true,
|
||||||
|
counter: 0,
|
||||||
|
speed: 30,
|
||||||
|
speed_change: false,
|
||||||
|
bitmap: get_sprite_addr!(player),
|
||||||
bitmap_frame: 0,
|
bitmap_frame: 0,
|
||||||
x: 10,
|
rect: Rect {
|
||||||
y: 10,
|
x: 0,
|
||||||
|
y: 8,
|
||||||
|
width: 8,
|
||||||
|
height: 8,
|
||||||
|
},
|
||||||
|
gameover_height: -30,
|
||||||
};
|
};
|
||||||
|
|
||||||
progmem!(
|
|
||||||
static mut walls: Vec<Enemy, 100> = Vec::new();
|
|
||||||
);
|
|
||||||
|
|
||||||
unsafe impl Sync for Player {}
|
unsafe impl Sync for Player {}
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum GameMode {
|
||||||
|
Titlescreen,
|
||||||
|
GameLoop,
|
||||||
|
Winscreen,
|
||||||
|
Losescreen,
|
||||||
|
Scoreboard,
|
||||||
|
Reset,
|
||||||
|
NextLevel,
|
||||||
|
}
|
||||||
|
|
||||||
// The setup() function runs once when you turn your Arduboy on
|
// The setup() function runs once when you turn your Arduboy on
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
@ -75,52 +87,174 @@ pub unsafe extern "C" fn loop_() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
arduboy.clear();
|
arduboy.clear();
|
||||||
sprites::draw_override(p.x, p.y, p.bitmap, p.bitmap_frame);
|
|
||||||
walls.iter_mut().for_each(|f| {
|
match p.gamemode {
|
||||||
sprites::draw_override(f.x * 8, f.y * 8, f.bitmap, f.bitmap_frame);
|
GameMode::Titlescreen => {
|
||||||
if arduboy.every_x_frames(30) {
|
sprites::draw_override(0, 0, get_sprite_addr!(titlescreen), 0);
|
||||||
f.move_down();
|
if arduboy.pressed(A) {
|
||||||
}
|
p.gamemode = GameMode::GameLoop;
|
||||||
});
|
|
||||||
if arduboy.every_x_frames(60) {
|
|
||||||
walls
|
|
||||||
.push(Enemy {
|
|
||||||
bitmap: get_sprite_addr!(pills),
|
|
||||||
bitmap_frame: random_less_than(3) as u8,
|
|
||||||
x: random_between(15, 16) as i16,
|
|
||||||
y: random_between(0, 8) as i16,
|
|
||||||
})
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
arduboy.poll_buttons();
|
|
||||||
if arduboy.pressed(UP) {
|
|
||||||
p.y -= 1;
|
|
||||||
}
|
|
||||||
if arduboy.pressed(DOWN) {
|
|
||||||
p.y += 1;
|
|
||||||
}
|
|
||||||
if arduboy.pressed(LEFT) {
|
|
||||||
p.x -= 1;
|
|
||||||
}
|
|
||||||
if arduboy.pressed(RIGHT) {
|
|
||||||
p.x += 1;
|
|
||||||
}
|
|
||||||
if arduboy.just_pressed(A) {
|
|
||||||
p.bitmap_frame += 1;
|
|
||||||
if p.bitmap_frame > 2 {
|
|
||||||
p.bitmap_frame = 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if arduboy.just_pressed(B) {
|
GameMode::GameLoop => {
|
||||||
walls
|
gameloop::gameloop();
|
||||||
.push(Enemy {
|
}
|
||||||
bitmap: get_sprite_addr!(pills),
|
GameMode::Losescreen => {
|
||||||
bitmap_frame: random_less_than(3) as u8,
|
//todo
|
||||||
x: random_between(15, 16) as i16,
|
arduboy.set_text_size(2);
|
||||||
y: random_between(0, 8) as i16,
|
arduboy.set_cursor(13, p.gameover_height);
|
||||||
})
|
arduboy.print(get_string_addr!(text_gameover));
|
||||||
.unwrap();
|
if arduboy.every_x_frames(2) && p.gameover_height < 15 {
|
||||||
|
p.gameover_height += 1
|
||||||
|
}
|
||||||
|
if p.gameover_height == 15 {
|
||||||
|
arduboy.set_text_size(1);
|
||||||
|
arduboy.set_cursor(13, 35);
|
||||||
|
arduboy.print(get_string_addr!(text_gameover_score));
|
||||||
|
arduboy.print(p.counter as i16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GameMode::Winscreen => {
|
||||||
|
arduboy.set_text_size(2);
|
||||||
|
arduboy.set_cursor(13, p.gameover_height);
|
||||||
|
arduboy.print(get_string_addr!(text_levelwin));
|
||||||
|
if arduboy.every_x_frames(2) && p.gameover_height < 15 {
|
||||||
|
p.gameover_height += 1
|
||||||
|
}
|
||||||
|
if p.gameover_height == 15 {
|
||||||
|
arduboy.set_text_size(1);
|
||||||
|
arduboy.set_cursor(13, 35);
|
||||||
|
arduboy.print(get_string_addr!(text_gameover_score));
|
||||||
|
arduboy.print(p.counter as i16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GameMode::Scoreboard => {
|
||||||
|
//todo
|
||||||
|
}
|
||||||
|
GameMode::Reset => {
|
||||||
|
//todo
|
||||||
|
}
|
||||||
|
GameMode::NextLevel => {
|
||||||
|
//todo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arduboy.display();
|
arduboy.display();
|
||||||
}
|
}
|
||||||
|
pub static mut enemy_count: u8 = 0;
|
||||||
|
pub static mut vec_enemies: Vec<Enemy, 30> = Vec::<Enemy, 30>::new();
|
||||||
|
progmem!(
|
||||||
|
static text_gameover: [u8; _] = *b"Game Over\0";
|
||||||
|
static text_levelwin: [u8; _] = *b"Congrats\0";
|
||||||
|
static text_gameover_score: [u8; _] = *b"Your score is: \0";
|
||||||
|
pub static player: [u8; _] = [
|
||||||
|
8, 8, // width, height,
|
||||||
|
0xa3, 0x51, 0xa6, 0x51, 0xa1, 0x56, 0xa1, 0x53, // TILE 00
|
||||||
|
0x7e, 0xdf, 0xb3, 0xdf, 0xbf, 0xd3, 0xbf, 0x7e, // TILE 01
|
||||||
|
0x7e, 0xc1, 0xad, 0xc1, 0xa1, 0xcd, 0xa1, 0x7e, // TILE 02
|
||||||
|
];
|
||||||
|
pub static titlescreen: [u8; _] = [
|
||||||
|
// width, height,
|
||||||
|
128, 64, 0xff, 0xff, 0xff, 0x3f, 0x1f, 0x0f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||||
|
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||||
|
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||||
|
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||||
|
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||||
|
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||||
|
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||||
|
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||||
|
0x07, 0x07, 0x07, 0x0f, 0x1f, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03,
|
||||||
|
0x07, 0x06, 0x1e, 0xfc, 0xf0, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x60, 0x30, 0x30, 0x30, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
|
||||||
|
0xc3, 0xc3, 0xc3, 0xc3, 0xe7, 0xfe, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe0, 0x60, 0x30,
|
||||||
|
0x30, 0x30, 0x30, 0x60, 0xe0, 0x80, 0x00, 0x10, 0xf0, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x80,
|
||||||
|
0xe0, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x7f, 0x7f, 0x60, 0x60, 0x60, 0x60, 0x60, 0x70, 0x30, 0x3c, 0x1f, 0x07, 0x00, 0x00,
|
||||||
|
0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x60, 0x60, 0x60, 0x60, 0x60, 0x71, 0x3f,
|
||||||
|
0x1e, 0x00, 0x00, 0x00, 0x0f, 0x3f, 0x30, 0x60, 0x60, 0x60, 0x60, 0x30, 0x3f, 0x0f, 0x00,
|
||||||
|
0x00, 0x00, 0x03, 0x0f, 0xfe, 0xf0, 0x3e, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x07, 0x03, 0x01, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x30, 0x10, 0x60, 0x10, 0x10, 0x60, 0x10, 0x30, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x60, 0x56, 0x60, 0x50,
|
||||||
|
0x66, 0x50, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x05, 0x0a, 0x05,
|
||||||
|
0x0a, 0x05, 0x0a, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x6f, 0x59,
|
||||||
|
0x6f, 0x5f, 0x69, 0x5f, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xe0, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||||
|
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||||
|
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||||
|
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||||
|
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||||
|
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||||
|
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xe0, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0xd9, 0xb6, 0xb6, 0xb6, 0xcd, 0xff, 0xc7, 0xbb, 0xbb, 0xbb, 0xff, 0xc7, 0xbb, 0xbb, 0xbb,
|
||||||
|
0xc7, 0xff, 0x83, 0xfb, 0xfb, 0xff, 0xff, 0xc7, 0xab, 0xab, 0xab, 0xa7, 0xff, 0xbb, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0xb6, 0xb6, 0xb6, 0xc9, 0xff, 0xff, 0x7f,
|
||||||
|
0x3e, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x1c, 0x3e, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0xf6, 0xf6, 0xf6, 0xf9, 0xff,
|
||||||
|
0x80, 0xff, 0x9f, 0xab, 0xab, 0xab, 0x87, 0xff, 0x73, 0x4f, 0x3f, 0xcf, 0xf3, 0xff, 0xbb,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xc7, 0xe9, 0xee, 0xe9, 0xc7, 0xbf,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
];
|
||||||
|
|
||||||
|
pub static overlay_score: [u8; _] = *b"Score: \0";
|
||||||
|
|
||||||
|
pub static enemies: [u8; _] = [
|
||||||
|
8, 8, // width, height,
|
||||||
|
0x7e, 0xd5, 0xab, 0xd5, 0xab, 0xd5, 0xab, 0x7e, // TILE 00 Gray
|
||||||
|
0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7e, // TILE 01 White
|
||||||
|
0x7e, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x7e, // TILE 02 Black
|
||||||
|
];
|
||||||
|
pub static overlay_3hearts: [u8; _] = [
|
||||||
|
// width, height,
|
||||||
|
64, 8, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x00, 0x7a, 0x00, 0x0c, 0x30, 0x40, 0x30, 0x0c,
|
||||||
|
0x00, 0x38, 0x54, 0x54, 0x58, 0x00, 0x58, 0x54, 0x54, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x0c, 0x1e, 0x3f, 0x7e, 0xfc, 0x7e, 0x3f, 0x1e, 0x0c, 0x00, 0x00, 0x0c, 0x1e, 0x3f, 0x7e,
|
||||||
|
0xfc, 0x7e, 0x3f, 0x1e, 0x0c, 0x00, 0x00, 0x0c, 0x1e, 0x3f, 0x7e, 0xfc, 0x7e, 0x3f, 0x1e,
|
||||||
|
0x0c, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
];
|
||||||
|
pub static overlay_2hearts: [u8; _] = [
|
||||||
|
// width, height,
|
||||||
|
64, 8, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x00, 0x7a, 0x00, 0x0c, 0x30, 0x40, 0x30, 0x0c,
|
||||||
|
0x00, 0x38, 0x54, 0x54, 0x58, 0x00, 0x58, 0x54, 0x54, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x0c, 0x1e, 0x3f, 0x7e, 0xfc, 0x7e, 0x3f, 0x1e, 0x0c, 0x00, 0x00, 0x0c, 0x1e, 0x3f, 0x7e,
|
||||||
|
0xfc, 0x7e, 0x3f, 0x1e, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
];
|
||||||
|
pub static overlay_1heart: [u8; _] = [
|
||||||
|
// width, height,
|
||||||
|
64, 8, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x00, 0x7a, 0x00, 0x0c, 0x30, 0x40, 0x30, 0x0c,
|
||||||
|
0x00, 0x38, 0x54, 0x54, 0x58, 0x00, 0x58, 0x54, 0x54, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x0c, 0x1e, 0x3f, 0x7e, 0xfc, 0x7e, 0x3f, 0x1e, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
];
|
||||||
|
);
|
||||||
|
|
|
@ -40,6 +40,7 @@ impl Not for Color {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// This struct is used by a few Arduboy functions.
|
/// This struct is used by a few Arduboy functions.
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub struct Rect {
|
pub struct Rect {
|
||||||
/// Position X
|
/// Position X
|
||||||
pub x: i16,
|
pub x: i16,
|
||||||
|
@ -51,6 +52,7 @@ pub struct Rect {
|
||||||
pub height: u8,
|
pub height: u8,
|
||||||
}
|
}
|
||||||
/// This struct is used by a few Arduboy functions.
|
/// This struct is used by a few Arduboy functions.
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub struct Point {
|
pub struct Point {
|
||||||
/// Position X
|
/// Position X
|
||||||
pub x: i16,
|
pub x: i16,
|
||||||
|
|
|
@ -80,7 +80,7 @@ pub(super) use progmem;
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! get_sprite_addr {
|
macro_rules! get_sprite_addr {
|
||||||
( $s:expr ) => {
|
( $s:expr ) => {
|
||||||
addr_of!($s) as *const u8
|
unsafe { addr_of!($s) as *const u8 }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
pub(super) use get_sprite_addr;
|
pub(super) use get_sprite_addr;
|
||||||
|
@ -89,7 +89,7 @@ pub(super) use get_sprite_addr;
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! get_tones_addr {
|
macro_rules! get_tones_addr {
|
||||||
( $s:expr ) => {
|
( $s:expr ) => {
|
||||||
addr_of!($s) as *const u16
|
unsafe { addr_of!($s) as *const u16 }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
pub(super) use get_tones_addr;
|
pub(super) use get_tones_addr;
|
||||||
|
@ -99,7 +99,7 @@ pub(super) use get_tones_addr;
|
||||||
macro_rules! get_string_addr {
|
macro_rules! get_string_addr {
|
||||||
( $s:expr ) => {
|
( $s:expr ) => {
|
||||||
Pstring {
|
Pstring {
|
||||||
pointer: addr_of!($s) as *const i8,
|
pointer: unsafe { addr_of!($s) as *const i8 },
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue