aboutsummaryrefslogtreecommitdiff
path: root/src/demo.c
diff options
context:
space:
mode:
authorNielsCoding <48092678+heavydemon21@users.noreply.github.com>2023-03-15 15:37:21 +0100
committerNielsCoding <48092678+heavydemon21@users.noreply.github.com>2023-03-15 15:37:21 +0100
commit3891486b368f4cdd1c5e00019a2a66ca05e656e6 (patch)
treecd27ef74ef917bed16c90be9552dd007b4a7f2b5 /src/demo.c
parent67bbe8dc3e7e0eb5eeb00b84f9766ef3d3b6b4b4 (diff)
game loop and bullet
TODO game loop: -(startingscreen) read correct indexes -(shop) read correct indexes -gameplay still needs alot with different levels etc.. rest not yet done bullet needs testing and correct PAL and tilemap reading
Diffstat (limited to 'src/demo.c')
-rw-r--r--src/demo.c62
1 files changed, 57 insertions, 5 deletions
diff --git a/src/demo.c b/src/demo.c
index 95347cb..f5b5c29 100644
--- a/src/demo.c
+++ b/src/demo.c
@@ -13,6 +13,17 @@
#include "engine/sprite_controller.h"
+#include "GameLoop/startingScreen.h"
+#include "GameLoop/shop.h"
+// states
+typedef enum {
+ hh_e_STATE_startingScreen,
+ hh_e_STATE_Shop,
+ hh_e_STATE_Gameplay,
+ hh_e_STATE_GameOver,
+ hh_e_STATE_HighScore
+} hh_e_GameState;
+hh_e_GameState hh_gameStates;
hh_s_entity_player g_hh_player_1 = {
.pos_x = 31000, // 0b0000 0001 0011 0110
@@ -45,18 +56,59 @@ typedef struct {
hh_entity hh_g_player, hh_g_player_new;
-void hh_demo_setup() {
-
+void hh_demo_setup() {
hh_setup_palettes();
- hh_setup_screen();
+ //hh_setup_screen();
}
-
void hh_demo_loop(unsigned long frame) {
// hh_player_movement();
+ switch (hh_gameStates)
+ {
+ case hh_e_STATE_startingScreen:
- hh_player_actions();
+ if(hh_show_startingScreen()){
+ hh_gameStates = hh_e_STATE_Shop;
+ }
+ break;
+ case hh_e_STATE_Shop:
+ // TODO:
+
+ if(hh_show_Shop()){
+ hh_gameStates = hh_e_STATE_Gameplay;
+ }
+ // function: new level is chosen goto level
+ break;
+ case hh_e_STATE_Gameplay:
+ static int run_test=0;
+ if(!run_test){
+ hh_setup_screen();
+ run_test=1;
+
+ }
+ else{
+ hh_player_actions();
+ }
+ // TODO:
+ // function: if level complete goto shop
+ // function: if player is dead goto game over
+ break;
+ case hh_e_STATE_GameOver:
+ // TODO:
+ // function: show game over screen
+ // function: after time goto high score
+ break;
+ case hh_e_STATE_HighScore:
+ // TODO:
+ // fucntion: show all previously scored points
+ // function: button pressed goto starting screen
+ break;
+ default:
+ hh_gameStates = hh_e_STATE_startingScreen;
+ break;
+ }
+
}