mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Start the sprites chapter
This commit is contained in:
parent
d483a84702
commit
e02fda5fc9
BIN
book/games/pong/gfx/sprites.aseprite
Normal file
BIN
book/games/pong/gfx/sprites.aseprite
Normal file
Binary file not shown.
BIN
book/games/pong/gfx/sprites.png
Normal file
BIN
book/games/pong/gfx/sprites.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 438 B |
6
book/games/pong/gfx/sprites.toml
Normal file
6
book/games/pong/gfx/sprites.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
version = "1.0"
|
||||
|
||||
[image.sprites]
|
||||
filename = "sprites.png"
|
||||
tile_size = "16x16"
|
||||
transparent_colour = "ff0044"
|
|
@ -10,3 +10,4 @@
|
|||
- [Building the game](./setup/building.md)
|
||||
- [Learn agb part I - pong](./pong/01_introduction.md)
|
||||
- [The Gba struct](./pong/02_the_gba_struct.md)
|
||||
- [Sprites](./pong/03_sprites.md)
|
30
book/src/pong/03_sprites.md
Normal file
30
book/src/pong/03_sprites.md
Normal file
|
@ -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"
|
||||
```
|
BIN
book/src/pong/sprites.png
Normal file
BIN
book/src/pong/sprites.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 438 B |
Loading…
Reference in a new issue