My actor.rpg avatar walking around on a GBA game
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Padding and commit the rom

+15 -10
-1
.gitignore
··· 1 1 target 2 2 agb 3 - pumpkin_head.gba 4 3 pumpkin_head.sav 5 4 .DS_Store
+2 -2
README.md
··· 1 1 # Pumpkin Head The Game 2 2 3 - They said it couldn't be done. But now you can play the exciting Pumpkin Head game play. 3 + They said it couldn't be done. But now you can play the exciting Pumpkin Head GBA game. 4 4 5 5 Okay 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/) 6 6 7 7 Post showing it [here](https://bsky.app/profile/pds.dad/post/3mkgkpk2vi22x) 8 8 9 9 10 - 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). 10 + 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
··· 41 41 } 42 42 43 43 const SPEED: Number = num!(0.75); 44 - const SPRITE_SIZE: i32 = 32; 44 + const SPRITE_WIDTH: i32 = 32; 45 + const SPRITE_HEIGHT: i32 = 64; 46 + 47 + // The sprite is closer to 32x47. But the gba doesn't like that sprite size so adding some padding 48 + const SPRITE_TOP_PADDING: i32 = 17; 49 + const VISIBLE_HEIGHT: i32 = SPRITE_HEIGHT - SPRITE_TOP_PADDING; 45 50 const FRAMES_PER_STEP: usize = 8; 46 51 47 52 #[agb::entry] ··· 54 59 let mut input = ButtonController::new(); 55 60 56 61 let mut position: Vector2D<Number> = vec2( 57 - Number::new((WIDTH - SPRITE_SIZE) / 2), 58 - Number::new((HEIGHT - SPRITE_SIZE) / 2), 62 + Number::new((WIDTH - SPRITE_WIDTH) / 2), 63 + Number::new((HEIGHT - VISIBLE_HEIGHT) / 2 - SPRITE_TOP_PADDING), 59 64 ); 60 65 let mut facing = Facing::Forward; 61 66 let mut walk_frames: usize = 0; 62 67 63 - let max_x = Number::new(WIDTH - SPRITE_SIZE); 64 - let max_y = Number::new(HEIGHT - SPRITE_SIZE); 68 + let max_x = Number::new(WIDTH - SPRITE_WIDTH); 69 + let max_y = Number::new(HEIGHT - SPRITE_HEIGHT); 70 + let min_y = Number::new(-SPRITE_TOP_PADDING); 65 71 66 72 loop { 67 73 input.update(); ··· 87 93 if position.x < num!(0.0) { 88 94 position.x = num!(0.0); 89 95 } 90 - if position.y < num!(0.0) { 91 - position.y = num!(0.0); 96 + if position.y < min_y { 97 + position.y = min_y; 92 98 } 93 99 if position.x > max_x { 94 100 position.x = max_x;