Gameboy Development Forum

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.

Ads

#1 2017-04-25 20:04:43

birucan
New member
Registered: 2017-04-25
Posts: 2

Loading 8*8 Sprites and 16*8 Sprites at the same time

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.
https://i.imgur.com/1tbuBRw.png

Offline

 

#2 2017-04-26 01:12:44

ssjason123
Member
Registered: 2017-03-21
Posts: 38

Re: Loading 8*8 Sprites and 16*8 Sprites at the same time

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

 

#3 2017-04-29 23:05:27

Tag365
Member
Registered: 2016-06-01
Posts: 41

Re: Loading 8*8 Sprites and 16*8 Sprites at the same time

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

 

#4 2017-04-30 03:28:12

Shonumi
New member
Registered: 2016-07-03
Posts: 8

Re: Loading 8*8 Sprites and 16*8 Sprites at the same time

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

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson