Hello!
Is there a way to use the accelerometer for my game to move the player/sprite? i need sth like the x,y and z coordinates. i found something interesting in the eventlistener: http://www.cocos2d-x.org/reference/html5-js/V3.0rc0/index.html but it seems, that the accelerometer is not really implemented. some code:
cc.eventManager.addListener(cc.EventListener().ctor(
cc.EventListener.ACCELERATION, "", //which tag?
function() {
cc.log("x: " + ________); //how to access to it?
cc.log("y: " + ________);
cc.log("z: " + ________);
}
)); //maybe some other mistake can be found?
some other method without a listener would also be very fine like:
var x = cc.accelerometer.gettilt().x;
maybe there is something like this, but i cant find it
there is also an other error i really dont understand: i cant use this.setTouchEnabled(true); for a layer, a scene or other nodes it says something like:
JS: /data/data/org.cocos2dx.PrebuiltRuntimeJs/files/debugruntime/src/game.js:14:TypeError: this.setTouchEnabled is not a function
in this piece of code:
var GameScene = cc.Scene.extend({
onEnter:function () {
this._super();
this.setTouchEnabled(true);
...
i cant run tutorials like jsmoonwarriors or ironcity because of some missing runtime. im using cocos ide and cocos2d-js-v3.0-rc1
do you can help me? thanks