@@ -157,7 +157,12 @@ bool GameScene::init() {
157157
158158 /* Initialize an ItemController */
159159 ItemController * item_controller = ItemController::create ();
160- this ->addChild (item_controller,498 );
160+ item_controller->bind_player (hero);
161+ this ->addChild (item_controller);
162+
163+ /* If uncomment the following statement, items will be hid under the bricks */
164+ // item_controller->setGlobalZOrder(0);
165+ monster_controller->setGlobalZOrder (99 );
161166 return true ;
162167}
163168
@@ -183,15 +188,15 @@ void GameScene::update(float delta) {
183188 }
184189
185190 /* Test pick_item method */
186- Item * speed_up_item = Item::create ();
187- speed_up_item->setPosition (Vec2 (500 , 380 ));
188- this ->addChild (speed_up_item);
189-
190- auto item_position = tileCoordFromPosition (speed_up_item->getPosition ());
191- auto hero_position = tileCoordFromPosition (hero->getPosition ());
192- if (item_position == hero_position) {
193- hero->pick_item (*speed_up_item);
194- }
191+ // Item * speed_up_item = Item::create();
192+ // speed_up_item->setPosition(Vec2(500, 380));
193+ // this->addChild(speed_up_item);
194+ //
195+ // auto item_position = tileCoordFromPosition(speed_up_item->getPosition());
196+ // auto hero_position = tileCoordFromPosition(hero->getPosition());
197+ // if (item_position == hero_position) {
198+ // hero->pick_item(*speed_up_item);
199+ // }
195200}
196201
197202void GameScene::bomb_explode (Bomb *bomb)
0 commit comments