started first level logic

This commit is contained in:
maka70vv 2025-03-02 21:55:27 +06:00
parent cc5401201d
commit ebf292d993
2 changed files with 25 additions and 2 deletions

View File

@ -11,7 +11,7 @@ const float GameObjectManager::INVENTORY_ICON_SIZE = 44.0f;
const float GameObjectManager::INVENTORY_MARGIN = 20.0f;
void GameObjectManager::initialize() {
bearName = "";
current_room_index = 0;
objects_in_inventory = 0;
@ -159,6 +159,25 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
}
else if (event.type == SDL_MOUSEBUTTONDOWN) {
if (InventoryItem* item = GetItemSelected(true)) {
if (InventoryItem* item = GetItemSelected(true)) {
if (current_room_index==1) {
if (bearName.length() < 3) {
if (item->name == "cube_T"){
bearName += "T";
selectedCubes.push_back(*item);
std::cout << bearName << std::endl;
}
else if (item->name == "cube_O"){
bearName += "O";
selectedCubes.push_back(*item);
}
else if (item->name == "cube_M"){
bearName += "M";
selectedCubes.push_back(*item);
}
}
}
}
}
else {

View File

@ -6,6 +6,7 @@
#include <vector>
#include "ActiveObject.h"
#include "Room.h"
#include "Inventory.h"
#ifdef __linux__
#include <SDL2/SDL.h>
#endif
@ -52,7 +53,10 @@ public:
std::vector<ZL::ActiveObject> activeObjects;
std::vector<ZL::Room> rooms;
std::vector<InventoryItem> selectedCubes;
std::string bearName;
AudioPlayerAsync audioPlayerAsync;
ZL::VertexDataStruct inventoryIconMesh;