···11# Pumpkin Head The Game
2233-They said it couldn't be done. But now you can play the exciting Pumpkin Head game play.
33+They said it couldn't be done. But now you can play the exciting Pumpkin Head GBA game.
4455Okay it's just really a demo of my [rpg.actor](https://rpg.actor) sprite walking around in a GBA game built with [agbrs](https://agbrs.dev/)
6677Post showing it [here](https://bsky.app/profile/pds.dad/post/3mkgkpk2vi22x)
88991010-If you're wanting to learn to build your own GBA with rust or to run this, best to start with [The agb book](https://agbrs.dev/book/introduction/introduction.html).
1010+If you're wanting to learn to build your own GBA with rust or to run this, best to start with [The agb book](https://agbrs.dev/book/introduction/introduction.html). Or if you just want to run the gba there's a binary at [pumpkin_head.gba](./pumpkin_head.gba)
pumpkin_head.gba
This is a binary file and will not be displayed.
+13-7
src/main.rs
···4141}
42424343const SPEED: Number = num!(0.75);
4444-const SPRITE_SIZE: i32 = 32;
4444+const SPRITE_WIDTH: i32 = 32;
4545+const SPRITE_HEIGHT: i32 = 64;
4646+4747+// The sprite is closer to 32x47. But the gba doesn't like that sprite size so adding some padding
4848+const SPRITE_TOP_PADDING: i32 = 17;
4949+const VISIBLE_HEIGHT: i32 = SPRITE_HEIGHT - SPRITE_TOP_PADDING;
4550const FRAMES_PER_STEP: usize = 8;
46514752#[agb::entry]
···5459 let mut input = ButtonController::new();
55605661 let mut position: Vector2D<Number> = vec2(
5757- Number::new((WIDTH - SPRITE_SIZE) / 2),
5858- Number::new((HEIGHT - SPRITE_SIZE) / 2),
6262+ Number::new((WIDTH - SPRITE_WIDTH) / 2),
6363+ Number::new((HEIGHT - VISIBLE_HEIGHT) / 2 - SPRITE_TOP_PADDING),
5964 );
6065 let mut facing = Facing::Forward;
6166 let mut walk_frames: usize = 0;
62676363- let max_x = Number::new(WIDTH - SPRITE_SIZE);
6464- let max_y = Number::new(HEIGHT - SPRITE_SIZE);
6868+ let max_x = Number::new(WIDTH - SPRITE_WIDTH);
6969+ let max_y = Number::new(HEIGHT - SPRITE_HEIGHT);
7070+ let min_y = Number::new(-SPRITE_TOP_PADDING);
65716672 loop {
6773 input.update();
···8793 if position.x < num!(0.0) {
8894 position.x = num!(0.0);
8995 }
9090- if position.y < num!(0.0) {
9191- position.y = num!(0.0);
9696+ if position.y < min_y {
9797+ position.y = min_y;
9298 }
9399 if position.x > max_x {
94100 position.x = max_x;