hello
i have developed a game with cocos2d js 3.0 rc1. now, at the end i cant solve one problem: i want to use touch, to move the player, but all methods i tested doesn’t work.it gives an exception at this.setTouchEnabled, this.setToiuchMode etc. it doesn’t react on the eventlisteener. my other program verions are: ant 1.9.4, ndk r9d, adt / sdk with android 17 pack + all tools + all extras. cocos2d code ide. programming at windows 8 64bit for android: samsung s3. i followed many tutorials e.g. https://www.youtube.com/watch?v=iZNYL8aCSKk + even the downloaded files doesn’t work
why is it not working? the methods this.settouchenabled etc. results in a type exception while running. my code looks like this (short version):
var GameScene = cc.Scene.extend({
_meter:0, //some variables, used in enter and update
_bildhohe:-600,
_label:null,
_image:null,
_audio:null,
_panel:null,
_platforms:null,
_speedplus:1,
_zahler:0,
onEnter:function () {
this._super();
this.setTouchEnabled(true); // if i comment this no error, but also no reaction
var gamescreen = ccs.SceneReader.getInstance().createNodeWithSceneFile("res/publish/NewScene2.json"); //by cocos studio
this.addChild(gamescreen, 0,1);
this._audio = cc.AudioEngine.getInstance();
this._audio.playMusic(res.music2, true);
var player = gamescreen.getChildByTag(10009);
this._label = gamescreen.getChildByTag(10005).getChildByTag(3).getChildByTag(13);
this._image = gamescreen.getChildByTag(10005).getChildByTag(3).getChildByTag(4);
this._panel = gamescreen.getChildByTag(10005).getChildByTag(3).getChildByTag(14);
cc.eventManager.addListener(cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
swallowTouches: true,
onTouchesBegan: function (touches, event) {
cc.log("Single touch has occured at A");
return true;
}
}),this);
this.scheduleUpdate();
return true;
},
onTouchBegan:function(touch, event)
{
cc.log("Single touch has occured at B");
},
update:function (dt) {
//some updating code for the gui
},
});
may i need to install cocos2d-x (not js) to use all classes?where could be the problem?