Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)
You are not logged in.
Hi, Im new to GB development and Im running into trouble loading sprites. Im making a pong clone and had the paddles showing and moving, the problem started when I tried to get the ball to display. it either changes every sprite to the ball, or everything to paddles or half the paddles sprite.
Offline
The sprite mode SPRITES_8X16 and SPRITES_8X8 are global flags and affect all sprites not an individual sprite. The "set_sprite_tile (sprite, tile);" call is responsible for setting the tile data that will be used. All of your calls are using 0 which maps to the first tile in 8x8 mode or the first 2 tiles in 8x16 mode.
Offline
It is impossible to draw 8x8 and 8x16 sprites at the same time. This is because they are separate modes, you can chose to draw in 8x8 pixel sprite mode or 8x16 pixel sprite mode, where you draw two tiles in the same sprite. You can use two sprites to represent an 8x16 object in the 8x8 mode. In the 8x16 mode you must have an empty tile loaded in the tile data after the ball tile, otherwise when the sprite is drawn it will draw the other unrelated tile below the tile you are drawing.
Offline
Realistically, the only way to get 8x8 and 8x16 sprites on the same screen at the same time would be to switch Bit 2 of LCDC mid-screen. For example, wait for a certain scanline to enter HBlank, then flip the bits. This isn't really practical, however, unless you want 8x8 sprites on the top or bottom and 8x16 on the other section, for whatever reason. For a game like Pong, such a technique wouldn't be useful.
Offline