finished cubes logic
This commit is contained in:
parent
ede7597acb
commit
4f2741765b
@ -161,6 +161,8 @@ void GameObjectManager::initialize() {
|
|||||||
objects_in_inventory++;
|
objects_in_inventory++;
|
||||||
AddItemToInventory("cube_O", std::make_shared<Texture>(CreateTextureDataFromBmp24("./Kitchen_ceramics.bmp")), objects_in_inventory + 1);
|
AddItemToInventory("cube_O", std::make_shared<Texture>(CreateTextureDataFromBmp24("./Kitchen_ceramics.bmp")), objects_in_inventory + 1);
|
||||||
objects_in_inventory++;
|
objects_in_inventory++;
|
||||||
|
AddItemToInventory("cube_M", std::make_shared<Texture>(CreateTextureDataFromBmp24("./Kitchen_ceramics.bmp")), objects_in_inventory + 1);
|
||||||
|
objects_in_inventory++;
|
||||||
|
|
||||||
|
|
||||||
//SDL_ShowCursor(SDL_DISABLE);
|
//SDL_ShowCursor(SDL_DISABLE);
|
||||||
@ -207,12 +209,13 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
|||||||
else if (event.type == SDL_MOUSEBUTTONDOWN) {
|
else if (event.type == SDL_MOUSEBUTTONDOWN) {
|
||||||
if (InventoryItem* item = GetItemSelected(true)) {
|
if (InventoryItem* item = GetItemSelected(true)) {
|
||||||
std::cout << item->name << std::endl;
|
std::cout << item->name << std::endl;
|
||||||
if (current_room_index==1) {
|
|
||||||
if (bearName.length() < 3) {
|
if (current_room_index==0) {
|
||||||
|
|
||||||
|
if (bearName.length() <= 3) {
|
||||||
if (item->name == "cube_T"){
|
if (item->name == "cube_T"){
|
||||||
bearName += "T";
|
bearName += "T";
|
||||||
selectedCubes.push_back(*item);
|
selectedCubes.push_back(*item);
|
||||||
std::cout << bearName << std::endl;
|
|
||||||
}
|
}
|
||||||
else if (item->name == "cube_O"){
|
else if (item->name == "cube_O"){
|
||||||
bearName += "O";
|
bearName += "O";
|
||||||
@ -224,6 +227,10 @@ void GameObjectManager::handleEvent(const SDL_Event& event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (bearName.length() >= 3 && !(bearName.compare("TOM") == 0)) {
|
||||||
|
bearName = "";
|
||||||
|
selectedCubes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@ -10,7 +10,10 @@ namespace ZL
|
|||||||
{
|
{
|
||||||
return [](GameObjectManager& gom, size_t ms)
|
return [](GameObjectManager& gom, size_t ms)
|
||||||
{
|
{
|
||||||
|
if (gom.bearName.compare("TOM") == 0) {
|
||||||
|
std::cout << gom.bearName << std::endl;
|
||||||
|
gom.switch_room(1);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user