[Updated] Code for use with WASM, [TODO] Make enemy gun follow player, spawn bullets from tip of the barrel

This commit is contained in:
Ninjaws
2024-12-17 23:15:26 +01:00
parent 2400b0500a
commit d740e1a167
25 changed files with 371 additions and 438 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
#include "screens/MainScreen.h"
#include "raylib.h"
#include "services/AudioService.h"
#include "services/StateService.h"
#include "raylib.h"
#include "services/InputService.h"
MainScreen::MainScreen()
@@ -60,7 +60,7 @@ void MainScreen::mouseLogic()
Vector2 pos = buttons[i].getPosition();
Rectangle rect = {pos.x, pos.y, dim.x, dim.y};
Vector2 mousePos = GetMousePosition();
Vector2 mousePos = InputService::getInstance().getMousePos();
// mousePos.x >= rect.x && mousePos.x <= (rect.x+rect.width) &&
if ((mousePos.x + textPadding) >= rect.x && mousePos.x <= (rect.x + rect.width + textPadding) && (mousePos.y + textPadding) >= rect.y && mousePos.y <= (rect.y + rect.height + textPadding))
{
-2
View File
@@ -3,7 +3,6 @@
#include "services/StateService.h"
#include "enums/EFont.h"
#include "services/AudioService.h"
#include <iostream>
#include "services/InputService.h"
TitleScreen::TitleScreen()
@@ -34,7 +33,6 @@ TitleScreen::TitleScreen()
void TitleScreen::logic()
{
// std::cout << "Next screen!" << std::endl;
if (InputService::getInstance().isKeyPressed(KEY_ENTER) || InputService::getInstance().isMouseButtonPressed(MOUSE_BUTTON_LEFT))
{
StateService::getInstance().setScreen(EScreen::MAIN);
+2 -3
View File
@@ -1,8 +1,7 @@
#include "screens/TutorialScreen.h"
#include "services/StateService.h"
#include "enums/EFont.h"
#include "enums/EScreen.h"
#include "enums/EFont.h"
#include "services/StateService.h"
#include "services/InputService.h"
TutorialScreen::TutorialScreen() {