AlyaKrupiankova Posted April 5, 2017 Share Posted April 5, 2017 Hi! Tell me please how to change this code? I want the man to jump from the keyboard. I tried to change the code myself, but nothing happened. Here is this code: cc.eventManager.addListener({ event: cc.EventListener.TOUCH_ONE_BY_ONE, swallowTouches: true, onTouchBegan: this.onTouchBegan, onTouchMoved: this.onTouchMoved, onTouchEnded: this.onTouchEnded }, this) onTouchBegan:function(touch, event) { var pos = touch.getLocation(); event.getCurrentTarget().recognizer.beginPoint(pos.x, pos.y); return true; }, onTouchMoved:function(touch, event) { var pos = touch.getLocation(); event.getCurrentTarget().recognizer.movePoint(pos.x, pos.y); }, onTouchEnded:function(touch, event) { var rtn = event.getCurrentTarget().recognizer.endPoint(); cc.log("rnt = " + rtn); switch (rtn) { case "up": event.getCurrentTarget().jump(); break; default: break; } }, Quote Link to comment Share on other sites More sharing options...
spinnerbox Posted April 5, 2017 Share Posted April 5, 2017 Phaser question? Quote Link to comment Share on other sites More sharing options...
AlyaKrupiankova Posted April 5, 2017 Author Share Posted April 5, 2017 No Quote Link to comment Share on other sites More sharing options...
AlyaKrupiankova Posted April 5, 2017 Author Share Posted April 5, 2017 cocos2d-js Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.