diff --git a/book/games/pong/gfx/sprites.aseprite b/book/games/pong/gfx/sprites.aseprite new file mode 100644 index 00000000..1c5bb9dc Binary files /dev/null and b/book/games/pong/gfx/sprites.aseprite differ diff --git a/book/games/pong/gfx/sprites.png b/book/games/pong/gfx/sprites.png new file mode 100644 index 00000000..9964bf0b Binary files /dev/null and b/book/games/pong/gfx/sprites.png differ diff --git a/book/games/pong/gfx/sprites.toml b/book/games/pong/gfx/sprites.toml new file mode 100644 index 00000000..39c68850 --- /dev/null +++ b/book/games/pong/gfx/sprites.toml @@ -0,0 +1,6 @@ +version = "1.0" + +[image.sprites] +filename = "sprites.png" +tile_size = "16x16" +transparent_colour = "ff0044" \ No newline at end of file diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index d6dbc84f..0b00be0d 100644 --- a/book/src/SUMMARY.md +++ b/book/src/SUMMARY.md @@ -9,4 +9,5 @@ - [Mac OS setup]() - [Building the game](./setup/building.md) - [Learn agb part I - pong](./pong/01_introduction.md) - - [The Gba struct](./pong/02_the_gba_struct.md) \ No newline at end of file + - [The Gba struct](./pong/02_the_gba_struct.md) + - [Sprites](./pong/03_sprites.md) \ No newline at end of file diff --git a/book/src/pong/03_sprites.md b/book/src/pong/03_sprites.md new file mode 100644 index 00000000..deb012fb --- /dev/null +++ b/book/src/pong/03_sprites.md @@ -0,0 +1,30 @@ +# Sprites + +In this section, we'll put the sprites needed for our pong game onto the screen. + +# Import the sprite + +Firstly, you're going to need to import the sprites into your project. +Save the following image into a new folder called `gfx` in your project: + +![pong sprites](sprites.png) + +This contains 5 `16x16px` sprites. +The first is the end cap for the paddle. +The second is the centre part of the paddle, which could potentially be repeated a few times. +The third until the fifth is the ball, with various squashed states. +The background is a lovely shade of `#ff0044` which we will use for the transparency. + +`agb` needs to know what the tile size is, and also what the transparent colour is so that it can properly produce data that the Game Boy Advance can understand. +So you need to create a manifest file for the image, which is declared in a toml file. + +In the same `gfx` folder as the `sprites.png` file, also create a `sprites.toml` file with the following content: + +```toml +version = "1.0" + +[image.sprites] +filename = "sprites.png" +tile_size = "16x16" +transparent_colour = "ff0044" +``` \ No newline at end of file diff --git a/book/src/pong/sprites.png b/book/src/pong/sprites.png new file mode 100644 index 00000000..9964bf0b Binary files /dev/null and b/book/src/pong/sprites.png differ