Hi,
I’m a littebit confused… If I click on the button the LOG shows me that the code is not sesrching for the right coordinates… And If I move my world it seemed that the position to click also is moveing …
This is my code:
void myClass::onTouchesBegan(const std::vector<Touch*>& touches, Event* event)
{
if(touches.size() < 1){
//Do nothing and return
return;
}
Touch* touch = touches[0];
touchLocation = touch->getLocation();
touchLocation = this->getGameWorldNode()->convertToNodeSpace(touchLocation);
//Levelhelper Camera
LHCamera* swipe = (LHCamera*)this-> getChildNodeWithName("mainCamera");
cameraStartPosition = swipe->getPosition();
//all other Sprites in Game-World
//this->handleNodesAtLocation(touchLocation);
//HUD-Layer (in other CPP FILE later)
HUD_layerLocation = touch->getLocation();
location_store_diamonds = touch->getLocation();
location_store_coins = touch->getLocation();
location_store_language = touch->getLocation();
location_userSettings = touch->getLocation();
location_settingsTest = touch->getLocation();
location_notification_coins= touch->getLocation();
location_notification_diamonds= touch->getLocation();
location_notification_unlock= touch->getLocation();
Point location = touch->getLocationInView();
location = this->getGameWorldNode()->convertToNodeSpace(location);
this->handleNodesAtLocation(location);
userTestHandler->userTest::handle_userTestSettings(location_settingsTest);
HUDlayerHandler->handleHUDlayer(HUD_layerLocation);
storeCoinsAssetHandler->handleStore_coins(location_store_coins);
storeDiamondsAssetHandler->handleStore_diamonds(location_store_diamonds);
storeLanguageAssetHandler->handleStore_language(location_store_language);
userSettingsHandler->handle_userSettings(location_userSettings);
notificationCoinsAssetHandler->handleNotification_coins(location_notification_coins);
notificationDiamondsAssetHandler->handleNotification_diamonds(location_notification_diamonds);
notificationUnlockAssetHandler->handleNotification_unlock(location_notification_unlock);
//userTestHandler->handle_userTestSettings(location_settingsTest);
//load function from other cpp
//loadFromOtherFile.handleHUDlayer(HUD_layerLocation);
HUDlayerHandler->showOrHideAds();
//dont forget to call super
LHScene::onTouchesBegan(touches, event);
}
-----------------------*/
void myClass::handleNodesAtLocation(Point screenLocation)
{
CCLOG(FILE "-> WOLRLD - CLICK");
Point sceneLocation = this->getGameWorldNode()->convertToNodeSpace(screenLocation);
CCWorld *_farmWorld = CCSoomlaLevelUp::getInstance()->getWorld(WORLD_FARM_ID);
/*----*/
if(_farmWorld->canStart()) {
CCLOG(FILE "TOUCH AKTION" );
{
LHSprite* btn_farm = (LHSprite*)this->getChildNodeWithName("farm_world_shape");
Point localPoint = btn_farm->getParent()->convertToNodeSpace(screenLocation);
if(btn_farm && btn_farm->getBoundingBox().containsPoint(localPoint))
{
//CCLOG(FILE "-> WOLRLD - CLICK");
if(_farmWorld->canStart()) {
CCLOG(FILE "World is unlocked." );
}
else {
CCLOG(FILE "World is locked. -> show Notification with Store" );
}
}
}
}
else {CCLOG(FILE "KEINE TOUCH AKTION" );}
/*----*/
}
WHAT IS WRONG???