12345678910111213141516171819202122232425262728293031 |
- import Joystick_8d from "./Joystick_8d";
- const {ccclass, property} = cc._decorator;
- @ccclass
- export default class JoystickTest extends cc.Component {
- @property(Joystick_8d)
- joystick: Joystick_8d = null;
- @property(cc.Node)
- mMoveNode: cc.Node = null;
- public runing:boolean;
- public dir:cc.Vec2;
- onLoad () {
- // this.joystick.setCallback((run:boolean,dir)=>{
- // this.runing = run;
- // this.dir = dir;
- // });
- }
-
- update (dt) {
- if(this.runing){
- this.mMoveNode.x += this.dir.x*5;
- this.mMoveNode.y += this.dir.y*5;
- }
- }
- }
|