From 54c3e1139e3e0e328f7ce3e8a2a61b0bf530a772 Mon Sep 17 00:00:00 2001 From: UnavailableDev Date: Wed, 22 Mar 2023 10:05:46 +0100 Subject: merge --- assets/TopLevel.PNG | Bin 0 -> 13919 bytes assets/hh_introScreen.png | Bin 0 -> 130932 bytes docs/BobSprint2.md | 19 ++++++++++++++++++ src/GameLoop/shop.c | 30 ++++++++++++++++++++++++++++ src/GameLoop/shop.h | 16 +++++++++++++++ src/GameLoop/startingScreen.c | 32 ++++++++++++++++++++++++++++++ src/GameLoop/startingScreen.h | 14 ++++++++++++++ src/engine/bullet.c | 44 ++++++++++++++++++++++++++++++++++++++++++ src/engine/bullet.h | 16 +++++++++++++++ 9 files changed, 171 insertions(+) create mode 100644 assets/TopLevel.PNG create mode 100644 assets/hh_introScreen.png create mode 100644 docs/BobSprint2.md create mode 100644 src/GameLoop/shop.c create mode 100644 src/GameLoop/shop.h create mode 100644 src/GameLoop/startingScreen.c create mode 100644 src/GameLoop/startingScreen.h create mode 100644 src/engine/bullet.c create mode 100644 src/engine/bullet.h diff --git a/assets/TopLevel.PNG b/assets/TopLevel.PNG new file mode 100644 index 0000000..2a7b16d Binary files /dev/null and b/assets/TopLevel.PNG differ diff --git a/assets/hh_introScreen.png b/assets/hh_introScreen.png new file mode 100644 index 0000000..8b6e192 Binary files /dev/null and b/assets/hh_introScreen.png differ diff --git a/docs/BobSprint2.md b/docs/BobSprint2.md new file mode 100644 index 0000000..6fff8fc --- /dev/null +++ b/docs/BobSprint2.md @@ -0,0 +1,19 @@ + + +# Proud of +Simulation: We're proud of the simulation that we created to test our game because it allows us to identify and address potential issues before the game is released. This helps ensure that the game is as polished and bug-free as possible. + +PPU: Our use of an FPGA-based PPU (Picture Processing Unit) in our game engine allows us to achieve high-quality graphics and smooth animation. This is important because it helps create an immersive and engaging gaming experience. + +Upscaling: We've implemented a sophisticated upscaling that allows us to scale up our game. This Ensures that our game runs smoothly and without any + +Collisions: We've put a lot of effort into making sure that our collision detection system is accurate and reliable. This ensures that the game mechanics work as intended and that players are able to navigate the game world without frustration. + +Artwork: We're proud of the artwork that was created which is stunning and imaginative artwork that brings the game world to life. From character designs to background artwork, every aspect of the game has been given careful attention to ensure that it looks as good as it plays. And more is coming! +# Challegens +Upscaling: While our upscaling algorithm is sophisticated, one of the challenges we faced was synchronization. Because we're upscaling in real-time, we had to ensure that the upscaling process didn't cause any lag or delay in the game. This required careful optimization of the algorithm and synchronization with other game components. + +PPU: While the use of an FPGA-based PPU allowed us to achieve high-quality graphics, it also presented some challenges. Specifically, the limited resources of the FPGA required us to optimize the PPU code to ensure that it could handle the demands of real-time gameplay. + +Communication bug fixes on the STM32: As with any complex system, we encountered some bugs in the communication between the STM32 microcontroller and the other components of the system. This required careful debugging and troubleshooting to identify and fix the issues. + diff --git a/src/GameLoop/shop.c b/src/GameLoop/shop.c new file mode 100644 index 0000000..eb6bed5 --- /dev/null +++ b/src/GameLoop/shop.c @@ -0,0 +1,30 @@ +#include "shop.h" + + +bool hh_show_Shop(){ + static hh_e_ShopStates hh_e_Shop = hh_e_STATE_SHOW; + + switch (hh_e_Shop) + { + case hh_e_STATE_SHOW: + //hh_clear_screen(); + + //hh_setup_shop(); + hh_e_Shop = hh_e_STATE_Input; + return false; + break; + case hh_e_STATE_Input: + if(g_hh_controller_p1.button_primary){ + hh_e_Shop = hh_e_STATE_END; + } + break; + case hh_e_STATE_END: + hh_e_Shop = hh_e_STATE_SHOW; + return true; + break; + default: + hh_e_Shop = hh_e_STATE_SHOW; + break; + } + return false; +} diff --git a/src/GameLoop/shop.h b/src/GameLoop/shop.h new file mode 100644 index 0000000..4014f58 --- /dev/null +++ b/src/GameLoop/shop.h @@ -0,0 +1,16 @@ +#include "input.h" +#include "engine/draw_screen.h" + + + +#include +#include + +typedef enum { + hh_e_STATE_SHOW, + hh_e_STATE_Input, + hh_e_STATE_END +} hh_e_ShopStates; + + +bool hh_show_Shop(); diff --git a/src/GameLoop/startingScreen.c b/src/GameLoop/startingScreen.c new file mode 100644 index 0000000..4fc5af9 --- /dev/null +++ b/src/GameLoop/startingScreen.c @@ -0,0 +1,32 @@ +#include "startingScreen.h" +#include "input.h" +#include "engine/title_screen.h" +#include "engine/draw_screen.h" +// #include "engine/player_controller.h" + +bool hh_show_startingScreen(){ + static hh_e_screenStates hh_e_startingScreen = hh_e_STATE_SHOW; + + switch (hh_e_startingScreen) + { + case hh_e_STATE_SHOW: + hh_clear_screen(); + hh_init_title_screen(); + hh_e_startingScreen = hh_e_STATE_Input; + return false; + break; + case hh_e_STATE_Input: + if(g_hh_controller_p1.button_primary){ + hh_e_startingScreen = hh_e_STATE_END; + } + break; + case hh_e_STATE_END: + hh_e_startingScreen = hh_e_STATE_SHOW; + return true; + break; + default: + hh_e_startingScreen = hh_e_STATE_SHOW; + break; + } + return false; +} diff --git a/src/GameLoop/startingScreen.h b/src/GameLoop/startingScreen.h new file mode 100644 index 0000000..f51cc66 --- /dev/null +++ b/src/GameLoop/startingScreen.h @@ -0,0 +1,14 @@ +#pragma once + +#include +#include + +typedef enum { + hh_e_STATE_SHOW, + hh_e_STATE_Input, + hh_e_STATE_END +} hh_e_screenStates; + + +bool hh_show_startingScreen(); + diff --git a/src/engine/bullet.c b/src/engine/bullet.c new file mode 100644 index 0000000..5aa9e51 --- /dev/null +++ b/src/engine/bullet.c @@ -0,0 +1,44 @@ +#include "bullet.h" +#include "engine/sprite_controller.h" + + +void shootBullet(vec2 playerPos, Bullet* bullet){ + // Set bullet's x and y coordinates to player's coordinates + bullet->x = playerPos.x; + bullet->y = playerPos.y; + // Set bullet's velocity to a fixed value + bullet->velocity = 1; + // Set bullet's status to active + bullet->isActive = true; +} +void updateBullet(Bullet* bullet, int deltaTime){ + // Only update bullet if it is active + static int latestLocationBullet = 0; + if (bullet->isActive) { + // Move bullet based on velocity and deltaTime + bullet->x += bullet->velocity * deltaTime; + drawBullet(bullet); + // Check if bullet has moved 16 pixels + if (bullet->x - latestLocationBullet > 32) { + // Set bullet's status to inactive + bullet->isActive = false; + drawBullet(&(Bullet){.x = -16,.y = -16. }); + } + } + else{ + latestLocationBullet = bullet->x; + } +} +void drawBullet(Bullet* bullet){ + + + hh_ppu_update_foreground(10, (hh_s_ppu_loc_fam_entry) + { + .position_x = bullet->x, + .position_y = bullet->y, + .horizontal_flip = false, + .vertical_flip = false, + .palette_index = 7, + .tilemap_index = 84, // change tilemap to the correct foreground index; + }); +} diff --git a/src/engine/bullet.h b/src/engine/bullet.h new file mode 100644 index 0000000..ad67d84 --- /dev/null +++ b/src/engine/bullet.h @@ -0,0 +1,16 @@ +#pragma once +#include "player_controller.h" + +typedef struct { + int x; + int y; + int velocity; + int isActive; + int hit; +} Bullet; + + +//Bullet* createBullet(float x, float y, float velocity, float direction); +void shootBullet(vec2 playerPos, Bullet* bullet); +void updateBullet(Bullet* bullet, int deltaTime); +void drawBullet(Bullet* bullet); -- cgit v1.2.3