diff --git a/bible.txt b/bible.txt index 615e1c1..49601fc 100644 --- a/bible.txt +++ b/bible.txt @@ -1,32 +1,57 @@ -########## -# THEMES # -########## - - +######### +# THEME # +######### + + - 100 (overheat) + - connect/transfer (???) + ############ # GAMEPLAY # ############ - - The player controls a ship which automatically flies forward through scrolling levels. - - It has a limited amount of fuel that constantly depletes. - - Fuel is replenished by destroying enemies + + - scrolling shmup either horizontal, isometric-ish, vertical depending on zone + - nitori will overheat if she doesn't kill (like fuel in vanguard) + - bomb + - single straight shot + ########## # LEVELS # ########## - - Tunnel 1 - - Mountain Zone - - Rainbow Zone - - Styx Zone - - Rainbow Zone 2 - - Stripe Zone - - Rainbow Zone 3 - - Bleak Zone - - Last Zone - - Tunnel 2 - - Mountain Zone - - Stripe Zone - - Styx Zone - - Rainbow Zone - - Bleak Zone - - Last Zone - - At the end of each tunnel the player must defeat a boss guarded by two moving force fields with holes in them. \ No newline at end of file + + - level 1 + - hori + - iso up + - hori + - iso down + - hori + - iso up + - tate + - boss + - level 2 + - hori + - hori + - hori + - iso up + - tate + - boss + - hopefully about 8 minutes by here. now we start looping with suicide bullets + - win screen or kill screen at lvl 255? !??!?!!!?! + + +############### +# ASSET NEEDS # +############### + + - tate sprite for nitori.... + - think connect/transfer + - bigger shot and robot sprite? + - 2 songs min needed + - start + - stage + - extra songs ordered by priority + - boss 1 + - boss 2 + - stage 2 + - game over screen \ No newline at end of file diff --git a/res/bg/1_1.png b/res/bg/1_1.png index 7ecb2c6..40de2b0 100644 Binary files a/res/bg/1_1.png and b/res/bg/1_1.png differ diff --git a/res/player/nitori.png b/res/player/nitori.png new file mode 100644 index 0000000..e36132e Binary files /dev/null and b/res/player/nitori.png differ diff --git a/res/player/player.png b/res/player/player.png deleted file mode 100644 index 49461d3..0000000 Binary files a/res/player/player.png and /dev/null differ diff --git a/res/player/reimu.png b/res/player/reimu.png new file mode 100644 index 0000000..a625fee Binary files /dev/null and b/res/player/reimu.png differ diff --git a/res/resources.res b/res/resources.res index e7850fa..4b91ac9 100644 --- a/res/resources.res +++ b/res/resources.res @@ -9,4 +9,4 @@ IMAGE frame1 "chrome/frame1.png" FAST IMAGE frame2 "chrome/frame2.png" FAST IMAGE frame3 "chrome/frame3.png" FAST -SPRITE reimu "player/player.png" 4 4 FAST 0 \ No newline at end of file +SPRITE nitori "player/nitori.png" 4 4 FAST \ No newline at end of file diff --git a/src/background.h b/src/background.h index 8eadfeb..8280db8 100644 --- a/src/background.h +++ b/src/background.h @@ -21,18 +21,20 @@ static void drawBg(){ // update -#define BG_SPEED_X -FIX16(0.2) -#define BG_SPEED_Y FIX16(0.1) + +#define BG_SPEED FIX16(1) +#define BG_SPEED_NORM FIX16(0.707) + #define BG_SIZE_F FIX16(BG_SIZE) Vect2D_f16 bgPos; static void scrollBg(){ VDP_setHorizontalScroll(BG_B, fix16ToInt(bgPos.x)); VDP_setVerticalScroll(BG_B, fix16ToInt(bgPos.y)); - bgPos.x = fix16Add(bgPos.x, BG_SPEED_X); - bgPos.y = fix16Add(bgPos.y, BG_SPEED_Y); - if(bgPos.x <= -BG_SIZE_F) bgPos.x = 0; - if(bgPos.y >= BG_SIZE_F) bgPos.y = 0; + bgPos.x = fix16Sub(bgPos.x, BG_SPEED); + // bgPos.y = fix16Add(bgPos.y, BG_SPEED_NORM); + if(bgPos.x <= -BG_SIZE_F) bgPos.x = fix16Add(bgPos.x, BG_SIZE_F); + if(bgPos.y >= BG_SIZE_F) bgPos.y = fix16Sub(bgPos.y, BG_SIZE_F); } @@ -43,5 +45,5 @@ void loadBg(){ } void updateBg(){ - // scrollBg(); + scrollBg(); } \ No newline at end of file diff --git a/src/main.c b/src/main.c index 1fd341d..38c5d99 100644 --- a/src/main.c +++ b/src/main.c @@ -26,13 +26,15 @@ static void loadInternals(){ static void loadGame(){ loadBg(); loadTiles(); + loadPlayer(); loadChrome(); } static void updateGame(){ + updateTiles(); + updatePlayer(); updateBg(); updateChrome(); - updateTiles(); clock++; if(clock >= CLOCK_LIMIT) clock -= CLOCK_LIMIT; } diff --git a/src/player.h b/src/player.h index 4e3e7c9..53cb5c9 100644 --- a/src/player.h +++ b/src/player.h @@ -1,12 +1,13 @@ // player #define PLAYER_OFF FIX16(16) -#define PLAYER_INIT_X FIX16(32) -#define PLAYER_INIT_Y FIX16(32) +#define PLAYER_INIT_X FIX16(40) +#define PLAYER_INIT_Y FIX16(GAME_H / 2) struct playerStruct { - Vect2D_f16 pos; + Vect2D_f16 pos, vel; Sprite* image; + s16 clock; }; struct playerStruct player; @@ -14,19 +15,76 @@ struct playerStruct player; // spawn static void spawnPlayer(){ - player.pos.x = 0; - player.pos.y = 0; - player.image = SPR_addSprite(&reimu, + player.pos.x = PLAYER_INIT_X; + player.pos.y = PLAYER_INIT_Y; + player.image = SPR_addSprite(&nitori, fix16ToInt(fix16Sub(player.pos.x, PLAYER_OFF)), fix16ToInt(fix16Sub(player.pos.y, PLAYER_OFF)), TILE_ATTR(PAL1, 0, 0, 0)); } +// collision + +#define PLAYER_LIMIT_X FIX16(16) +#define PLAYER_LIMIT_W FIX16(GAME_W - 16) +#define PLAYER_LIMIT_Y FIX16(16) +#define PLAYER_LIMIT_H FIX16(GAME_H - 16) + +static void checkPlayerBounds(){ + if(player.pos.x < PLAYER_LIMIT_X) player.pos.x = PLAYER_LIMIT_X; + else if(player.pos.x > PLAYER_LIMIT_W) player.pos.x = PLAYER_LIMIT_W; + if(player.pos.y < PLAYER_LIMIT_Y) player.pos.y = PLAYER_LIMIT_Y; + else if(player.pos.y > PLAYER_LIMIT_H) player.pos.y = PLAYER_LIMIT_H; +} + +// movement + +#define PLAYER_SPEED FIX16(2) +#define PLAYER_SPEED_NORM FIX16(2 * 0.707) + +s16 playerFrame; + +static void movePlayer(){ + playerFrame = 0; + if(ctrl.left || ctrl.right || ctrl.up || ctrl.down){ + if(ctrl.left || ctrl.right){ + if(ctrl.up || ctrl.down){ + player.vel.x = ctrl.left ? -PLAYER_SPEED_NORM : PLAYER_SPEED_NORM; + player.vel.y = ctrl.up ? -PLAYER_SPEED_NORM : PLAYER_SPEED_NORM; + playerFrame = ctrl.up ? 2 : 1; + } else { + player.vel.x = ctrl.left ? -PLAYER_SPEED : PLAYER_SPEED; + player.vel.y = 0; + } + } else if(ctrl.up){ + player.vel.x = 0; + player.vel.y = -PLAYER_SPEED; + playerFrame = 2; + } else if(ctrl.down){ + player.vel.x = 0; + player.vel.y = PLAYER_SPEED; + playerFrame = 1; + } + if(player.vel.x != 0) player.pos.x = fix16Add(player.pos.x, player.vel.x); + if(player.vel.y != 0) player.pos.y = fix16Add(player.pos.y, player.vel.y); + checkPlayerBounds(); + } + SPR_setFrame(player.image, playerFrame); +} + + // loop -void loadPlayer(){} +void loadPlayer(){ + spawnPlayer(); +} void updatePlayer(){ - spawnPlayer(); + movePlayer(); + SPR_setPosition(player.image, + fix16ToInt(fix16Sub(player.pos.x, PLAYER_OFF)), + fix16ToInt(fix16Sub(player.pos.y, PLAYER_OFF))); + player.clock++; + if(player.clock >= CLOCK_LIMIT) player.clock -= CLOCK_LIMIT; } \ No newline at end of file