more-generic-sprites #3

Merged
alvierahman90 merged 4 commits from more-generic-sprites into main 2022-06-12 18:38:55 +00:00
6 changed files with 17 additions and 13 deletions
Showing only changes of commit 776cf354f8 - Show all commits

View File

@ -10,7 +10,7 @@
Compression : None.
Counter : None.
Tile size : 8 x 8
Tiles : 0 to 10
Tiles : 0 to 11
Palette colors : None.
SGB Palette : None.
@ -27,8 +27,8 @@
/* Start of tile array. */
unsigned char sprites[] =
{
0xF7,0x08,0xED,0x12,0xFE,0x11,0xFF,0x38,
0xFE,0x39,0xFE,0x39,0xFF,0x7E,0xFF,0x6E,
0xFF,0x19,0xEF,0x17,0xFF,0x11,0xFF,0x3B,
0xFE,0x3F,0xFE,0x3D,0xFF,0x7E,0xFF,0x6E,
0xFF,0x00,0xC3,0x42,0x81,0x00,0x81,0x00,
0x81,0x00,0x81,0x00,0xC3,0x42,0xFF,0x00,
0xC3,0xC3,0xDB,0xDB,0x3C,0x3C,0x7E,0x7E,
@ -48,7 +48,9 @@ unsigned char sprites[] =
0xC3,0xC3,0xDB,0xDB,0x3C,0x3C,0x7E,0x7E,
0x7E,0x7E,0x3C,0x3C,0xDB,0xDB,0x42,0xC3,
0x43,0xC3,0xDB,0xDB,0x3C,0x3C,0x7E,0x7E,
0x7E,0x7E,0x3C,0x3C,0xDB,0xDB,0x43,0xC3
0x7E,0x7E,0x3C,0x3C,0xDB,0xDB,0x43,0xC3,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x43,0x38,0xC6,0x00,0x43
};
@ -64,7 +66,7 @@ SpriteCorners sprite_offsets[] = {
{ .itl = { .x = 8, .y = 8}, .itr = { .x = 1, .y = 8}, .ibl = { .x = 8, .y = 1}, .ibr = { .x = 1, .y = 1}, },
{ .itl = { .x = 8, .y = 8}, .itr = { .x = 1, .y = 8}, .ibl = { .x = 8, .y = 1}, .ibr = { .x = 1, .y = 1}, },
{ .itl = { .x = 8, .y = 8}, .itr = { .x = 1, .y = 8}, .ibl = { .x = 8, .y = 1}, .ibr = { .x = 1, .y = 1}, },
{ .itl = { .x = 8, .y = 8}, .itr = { .x = 1, .y = 8}, .ibl = { .x = 8, .y = 1}, .ibr = { .x = 1, .y = 1}, }
{ .itl = { .x = 8, .y = 8}, .itr = { .x = 1, .y = 8}, .ibl = { .x = 8, .y = 1}, .ibr = { .x = 1, .y = 1}, },
{ .itl = { .x = 8, .y = 3}, .itr = { .x = 1, .y = 3}, .ibl = { .x = 8, .y = 1}, .ibr = { .x = 1, .y = 1}, }
};
/* End of SPRITES.C */

Binary file not shown.

View File

@ -10,7 +10,7 @@
Compression : None.
Counter : None.
Tile size : 8 x 8
Tiles : 0 to 10
Tiles : 0 to 11
Palette colors : None.
SGB Palette : None.

View File

@ -25,8 +25,8 @@
/* Start of tile array. */
unsigned char tiles[] =
{
0x10,0x00,0x00,0x00,0x08,0x00,0x10,0x00,
0x30,0x00,0x20,0x00,0x60,0x00,0x50,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0x00,0xFF,0x00,0xFF,
0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,
0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,

Binary file not shown.

View File

@ -8,14 +8,16 @@
#include "./sprite.h"
#include "./vec.h"
#define SPRITE_NO 11
void init_gfx()
{
// Load Background tiles and then map
set_bkg_data(0, 23, tiles);
set_bkg_tiles(0, 0, map.width, map.height, map.data);
set_sprite_data(0, 11, sprites);
set_sprite_tile(0, 2);
set_sprite_data(0, 12, sprites);
set_sprite_tile(0, SPRITE_NO);
set_sprite_prop(0, 0);
// Turn the background map on to make it visible
@ -36,7 +38,7 @@ void main(void)
sprite.vel.y = 0;
sprite.acc.x = 0;
sprite.acc.y = 0;
sprite.collision_offset = sprite_offsets[0];
sprite.collision_offset = sprite_offsets[SPRITE_NO];
move_sprite(0, sprite.pos.x, sprite.pos.y);