Cocos creator to cocos2dx update function not working

Cocos creator to cocos2dx update function not working

Hi can anybody please help me i am stuck on a problem and more than a week has passed i didnt find a solution please help me my problem is i want to develop a game something like angry birds and i am using cocos creator for level building and then i export it to my cocos2dx project all is working fine i can run the scene in cocos2dx but i am unable to call the update method in which i will run box2d simulation like world->Step(dt, velocityIterations, positionIterations); i have browse all over internet but dont found any solution
my cpp file is:

#include “GameScene.h”

Scene* GameScene::createScene()
reader = creator::CreatorReader::createWithFilename(“creator/Scene/level.ccreator”);
Scene * GameScene = reader->getSceneGraph();
return GameScene;


void GameScene::init(Scene *scene)
auto sprite = scene->getChildByName(“Canvas”)->getChildByName(“background”);


void GameScene::update(float dt)
log(“update called”);


and my header file is:

#ifndef GameScene_hpp

#define GameScene_hpp

#include <stdio.h>

#include “cocos2d.h”

#include <Box2D/Box2D.h>

#include “Definition.h”

#include “reader/CreatorReader.h”


class GameScene : public Scene


public :

Scene* createScene();

creator::CreatorReader* reader;

void update( float dt);

void init(Scene* scene);



#endif /* GameScene_hpp */

i have tried all method scheduleupdate() ,
but the update() function wont run and without it i cant use box2d physics

Are you using Creator 1.9.3? Creator 2.x+ doesn’t support the c++ export plugin

yes i am using 1.9.3
and cocos2dx 3.17.2

Have you tried scheduleUpdate()?

all is working fine i am able to run scene in cocos2dx but the problem is update method not working and without it i cant use physics

yes i have tried it and it shows me this error Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
at HASH_FIND_PTR(_hashForUpdates, &target, hashElement);

scheduleUpdate for for me updating Physics world. Manual and automatic step.

yes scheduleUpdate for updating physics world and other game related stuff but i can i make it to work

i am doing it like this in SceneInit method

void GameScene::init(Scene *scene)
auto sprite = scene->getChildByName(“Canvas”)->getChildByName(“background”);

still not working same error . at HASH_FIND_PTR

if this doesn’t help: then post your project so I can just open it and see the whole picture.

i have check it and it doesnt help still getting the same error i tried again by calling scene sheduler like this
scene->schedule(CC_SCHEDULE_SELECTOR(GameScene::update), 0.5f);
by doing this scene run well without crash but still update not calling i have posted the project here please check it and help me

hey have you seen the project which i have posted

I will try and look at it today.

update: It looks like some source files are missing from the GitHub repo visibleRect.h, other Box2d files and also graphic some resources. I’m trying to comment out to build, but I’m unsuccessful.

i forget to delete them before uploading

delete all classes except GameScene and AppDelegate

ok, it looks like definitions.h is also needed. I;m looking at this now.

yeah these files are related to other project the main file is GameScene

I’ve got it running, how would you like me to test this. What should I expect to happen?

in GameScene.cpp file this code function is not running
void GameScene::update(float dt)
log(“scene start”);

without an update function we cant do other coding , logical stuff in game

Would you mind sharing your logic for this?

// create a scene. it's an autorelease object
    GameScene* gameScene;
    auto scene = gameScene->createScene();
    // run

I think you are best to see what a cocos new project gives you. It seems to work out of the box with scheduleUpdate()