From f6683fa71fa670cfbe6aa6233fafb869295da11a Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Thu, 9 Jan 2025 21:14:35 +0100 Subject: added shop functionality --- game/menus/shop/ShopLoadScript.cpp | 131 +++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 game/menus/shop/ShopLoadScript.cpp (limited to 'game/menus/shop/ShopLoadScript.cpp') diff --git a/game/menus/shop/ShopLoadScript.cpp b/game/menus/shop/ShopLoadScript.cpp new file mode 100644 index 0000000..a9f9bfe --- /dev/null +++ b/game/menus/shop/ShopLoadScript.cpp @@ -0,0 +1,131 @@ +#include "ShopLoadScript.h" +#include +#include "api/Button.h" +#include "api/Sprite.h" +#include "Shopconfig.h" +#include "api/Text.h" +#include "manager/SaveManager.h" + +using namespace crepe; +using namespace std; + +void ShopLoadScript::init() { + this->update(); + this->subscribe([this](const ShopUpdate e) { + return this->update(); + }); +} + +bool ShopLoadScript::update(){ + SaveManager & save = this->get_save_manager(); + ValueBroker buy_bullet = save.get(BUY_BULLET_SAVE,0); + ValueBroker buy_bubble = save.get(BUY_BUBBLE_SAVE,0); + + + if(buy_bullet.get()){ + auto sprites = this->get_components_by_tag(BUY_BULLET); + for(auto sprite : sprites){ + sprite.get().active = false; + } + auto buttons = this->get_components_by_tag