add arrow sprite

This commit is contained in:
Akbar Rahman 2022-06-09 16:07:21 +01:00
parent 3b186a3d75
commit 776cf354f8
Signed by: alvierahman90
GPG Key ID: 20609519444A1269
6 changed files with 17 additions and 13 deletions

View File

@ -10,7 +10,7 @@
Compression : None. Compression : None.
Counter : None. Counter : None.
Tile size : 8 x 8 Tile size : 8 x 8
Tiles : 0 to 10 Tiles : 0 to 11
Palette colors : None. Palette colors : None.
SGB Palette : None. SGB Palette : None.
@ -27,8 +27,8 @@
/* Start of tile array. */ /* Start of tile array. */
unsigned char sprites[] = unsigned char sprites[] =
{ {
0xF7,0x08,0xED,0x12,0xFE,0x11,0xFF,0x38, 0xFF,0x19,0xEF,0x17,0xFF,0x11,0xFF,0x3B,
0xFE,0x39,0xFE,0x39,0xFF,0x7E,0xFF,0x6E, 0xFE,0x3F,0xFE,0x3D,0xFF,0x7E,0xFF,0x6E,
0xFF,0x00,0xC3,0x42,0x81,0x00,0x81,0x00, 0xFF,0x00,0xC3,0x42,0x81,0x00,0x81,0x00,
0x81,0x00,0x81,0x00,0xC3,0x42,0xFF,0x00, 0x81,0x00,0x81,0x00,0xC3,0x42,0xFF,0x00,
0xC3,0xC3,0xDB,0xDB,0x3C,0x3C,0x7E,0x7E, 0xC3,0xC3,0xDB,0xDB,0x3C,0x3C,0x7E,0x7E,
@ -48,7 +48,9 @@ unsigned char sprites[] =
0xC3,0xC3,0xDB,0xDB,0x3C,0x3C,0x7E,0x7E, 0xC3,0xC3,0xDB,0xDB,0x3C,0x3C,0x7E,0x7E,
0x7E,0x7E,0x3C,0x3C,0xDB,0xDB,0x42,0xC3, 0x7E,0x7E,0x3C,0x3C,0xDB,0xDB,0x42,0xC3,
0x43,0xC3,0xDB,0xDB,0x3C,0x3C,0x7E,0x7E, 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 = 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 */ /* End of SPRITES.C */

Binary file not shown.

View File

@ -10,7 +10,7 @@
Compression : None. Compression : None.
Counter : None. Counter : None.
Tile size : 8 x 8 Tile size : 8 x 8
Tiles : 0 to 10 Tiles : 0 to 11
Palette colors : None. Palette colors : None.
SGB Palette : None. SGB Palette : None.
@ -22,7 +22,7 @@
*/ */
#include "../src/sprite.h" #include "../src/sprite.h"
/* Bank of tiles. */ /* Bank of tiles. */
#define spritesBank 0 #define spritesBank 0

View File

@ -25,8 +25,8 @@
/* Start of tile array. */ /* Start of tile array. */
unsigned char tiles[] = unsigned char tiles[] =
{ {
0x10,0x00,0x00,0x00,0x08,0x00,0x10,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x30,0x00,0x20,0x00,0x60,0x00,0x50,0x20, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xFF,0xFF,0xFF,0xFF,0x00,0xFF,0x00,0xFF, 0xFF,0xFF,0xFF,0xFF,0x00,0xFF,0x00,0xFF,
0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF, 0x00,0xFF,0x00,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 "./sprite.h"
#include "./vec.h" #include "./vec.h"
#define SPRITE_NO 11
void init_gfx() void init_gfx()
{ {
// Load Background tiles and then map // Load Background tiles and then map
set_bkg_data(0, 23, tiles); set_bkg_data(0, 23, tiles);
set_bkg_tiles(0, 0, map.width, map.height, map.data); set_bkg_tiles(0, 0, map.width, map.height, map.data);
set_sprite_data(0, 11, sprites); set_sprite_data(0, 12, sprites);
set_sprite_tile(0, 2); set_sprite_tile(0, SPRITE_NO);
set_sprite_prop(0, 0); set_sprite_prop(0, 0);
// Turn the background map on to make it visible // Turn the background map on to make it visible
@ -36,7 +38,7 @@ void main(void)
sprite.vel.y = 0; sprite.vel.y = 0;
sprite.acc.x = 0; sprite.acc.x = 0;
sprite.acc.y = 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); move_sprite(0, sprite.pos.x, sprite.pos.y);