From 9239a34256441fc8dc7695002401376f801a834b Mon Sep 17 00:00:00 2001 From: Alvie Rahman Date: Sun, 12 Jun 2022 22:45:35 +0100 Subject: [PATCH] add mike character --- readme.md | 7 +++ res/sprite_metadata.c | 136 ++++++++++++++++++++++++++++++++++++++++++ res/sprites.c | 28 ++++++++- res/sprites.h | 2 +- src/main.c | 4 +- 5 files changed, 172 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index c128e0b..12e6de6 100644 --- a/readme.md +++ b/readme.md @@ -16,3 +16,10 @@ make all ``` the gameboy rom will be output to `obj/untitled2dshooter.gb` + + +## credits + +### art + +a cool guy named louie - drew mike diff --git a/res/sprite_metadata.c b/res/sprite_metadata.c index b72f131..09a447d 100644 --- a/res/sprite_metadata.c +++ b/res/sprite_metadata.c @@ -70,5 +70,141 @@ Sprite sprites_info[] = { .ibl = { .x = 7, .y = 1}, .ibr = { .x = 1, .y = 1}, } + }, + { + .frames_since_last_dash = 0, + .frames_since_last_jump = 0, + .name = "dodgy_hat_guy", + .has_diag_sprites = 0, + .bitmap_index = SI_LEFT, + .has_joypad = 0, + .pos = { .x = 0, .y = 0}, + .vel = { .x = 0, .y = 0}, + .acc = { .x = 0, .y = 0}, + + .bitmap_indexes[SI_UP] = 14, .bitmap_prop[SI_UP] = 0, + .collision_offset[SI_UP] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_DOWN] = 15, .bitmap_prop[SI_DOWN] = 0, + .collision_offset[SI_DOWN] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_LEFT] = 14, .bitmap_prop[SI_LEFT] = 0, + .collision_offset[SI_LEFT] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_RIGHT] = 14, .bitmap_prop[SI_RIGHT] = S_FLIPX, + .collision_offset[SI_RIGHT] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_UP_RIGHT] = 14, .bitmap_prop[SI_UP_RIGHT] = 0, + .collision_offset[SI_UP_RIGHT] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_UP_LEFT] = 14, .bitmap_prop[SI_UP_LEFT] = S_FLIPX, + .collision_offset[SI_UP_LEFT] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_DOWN_LEFT] = 15, .bitmap_prop[SI_DOWN_LEFT] = 0, + .collision_offset[SI_DOWN_LEFT] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_DOWN_RIGHT] = 15, .bitmap_prop[SI_DOWN_RIGHT] = S_FLIPX, + .collision_offset[SI_DOWN_RIGHT] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + } + }, + { + .frames_since_last_dash = 0, + .frames_since_last_jump = 0, + .name = "mike", + .has_diag_sprites = 0, + .bitmap_index = SI_LEFT, + .has_joypad = 0, + .pos = { .x = 0, .y = 0}, + .vel = { .x = 0, .y = 0}, + .acc = { .x = 0, .y = 0}, + + .bitmap_indexes[SI_UP] = 25, .bitmap_prop[SI_UP] = 0, + .collision_offset[SI_UP] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_DOWN] = 22, .bitmap_prop[SI_DOWN] = 0, + .collision_offset[SI_DOWN] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_LEFT] = 21, .bitmap_prop[SI_LEFT] = 0, + .collision_offset[SI_LEFT] = { + .itl = { .x = 8, .y = 5}, + .itr = { .x = 1, .y = 5}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_RIGHT] = 21, .bitmap_prop[SI_RIGHT] = S_FLIPX, + .collision_offset[SI_RIGHT] = { + .itl = { .x = 8, .y = 5}, + .itr = { .x = 1, .y = 5}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_UP_RIGHT] = 23, .bitmap_prop[SI_UP_RIGHT] = 0, + .collision_offset[SI_UP_RIGHT] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_UP_LEFT] = 23, .bitmap_prop[SI_UP_LEFT] = S_FLIPX, + .collision_offset[SI_UP_LEFT] = { + .itl = { .x = 8, .y = 8}, + .itr = { .x = 1, .y = 8}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_DOWN_LEFT] = 24, .bitmap_prop[SI_DOWN_LEFT] = S_FLIPX, + .collision_offset[SI_DOWN_LEFT] = { + .itl = { .x = 8, .y = 7}, + .itr = { .x = 1, .y = 7}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + }, + .bitmap_indexes[SI_DOWN_RIGHT] = 24, .bitmap_prop[SI_DOWN_RIGHT] = 0, + .collision_offset[SI_DOWN_RIGHT] = { + .itl = { .x = 8, .y = 7}, + .itr = { .x = 1, .y = 7}, + .ibl = { .x = 8, .y = 1}, + .ibr = { .x = 1, .y = 1}, + } } }; diff --git a/res/sprites.c b/res/sprites.c index 0b8b68a..630ee88 100644 --- a/res/sprites.c +++ b/res/sprites.c @@ -10,7 +10,7 @@ Compression : None. Counter : None. Tile size : 8 x 8 - Tiles : 0 to 13 + Tiles : 0 to 25 Palette colors : None. SGB Palette : None. @@ -52,7 +52,31 @@ unsigned char sprites[] = 0x00,0x02,0x00,0x07,0x02,0x00,0x02,0x00, 0x02,0x00,0x00,0x02,0x00,0x07,0x00,0x05, 0x00,0x03,0x02,0x01,0x04,0x00,0x08,0x00, - 0x00,0x30,0x00,0x50,0x00,0x20,0x00,0x00 + 0x00,0x30,0x00,0x50,0x00,0x20,0x00,0x00, + 0x38,0x38,0x7C,0x7C,0x7C,0x44,0x38,0x00, + 0x18,0x00,0x18,0x18,0xBD,0xBD,0xBD,0xBD, + 0x38,0x38,0x7C,0x7C,0x7C,0x44,0x39,0x01, + 0x99,0x81,0x98,0x98,0x3C,0x3C,0x3C,0x3C, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E, + 0x25,0xFE,0x18,0xE7,0x7E,0xFF,0x00,0xDB, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C, + 0x38,0xEE,0x52,0xAD,0x7C,0xFF,0x01,0xD7, + 0x00,0x38,0x10,0x6E,0x2C,0x77,0x22,0xDD, + 0x7E,0xFF,0x12,0xC9,0x18,0xE7,0x00,0x7E, + 0x00,0x38,0x10,0x6C,0x3C,0xC6,0x60,0xBF, + 0x0E,0xFF,0x78,0xF3,0x00,0xDE,0x00,0x70, + 0x00,0x00,0x30,0x4C,0x70,0x9E,0x06,0xFB, + 0x7C,0xF3,0x0E,0x5F,0x00,0x7B,0x00,0x1E, + 0x00,0x7E,0x18,0xE7,0x36,0xED,0x02,0xFD, + 0x7E,0xFF,0x08,0x53,0x10,0x6E,0x00,0x38 }; /* End of SPRITES.C */ diff --git a/res/sprites.h b/res/sprites.h index d57e0f0..43f8b66 100644 --- a/res/sprites.h +++ b/res/sprites.h @@ -10,7 +10,7 @@ Compression : None. Counter : None. Tile size : 8 x 8 - Tiles : 0 to 13 + Tiles : 0 to 25 Palette colors : None. SGB Palette : None. diff --git a/src/main.c b/src/main.c index 023103d..d7c61f6 100644 --- a/src/main.c +++ b/src/main.c @@ -19,7 +19,7 @@ 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, 14, sprites); + set_sprite_data(0, 26, sprites); // Turn the background map on to make it visible SHOW_BKG; @@ -34,7 +34,7 @@ void main(void) struct Sprites screen_sprites[NO_SCREEN_SPRITES]; - memcpy(&(screen_sprites[0]), &(sprites_info[0]), sizeof(Sprite)); + memcpy(&(screen_sprites[0]), &(sprites_info[2]), sizeof(Sprite)); memcpy(&(screen_sprites[1]), &(sprites_info[0]), sizeof(Sprite)); screen_sprites[0].has_joypad = 1; screen_sprites[1].bitmap_index = SI_UP;