您的位置:首页 > 其它

Typescript | 箭头函数返回值

2018-11-01 21:59 489 查看
[code]/*
* @Author: AK-12
* @Date: 2018-11-01 20:07:29
* @Last Modified by: AK-12
* @Last Modified time: 2018-11-01 22:00:41
*/
import IBlock from './IBlock'

export default class Block implements IBlock {
private sprite: cc.Sprite
constructor(sprite: cc.Sprite) {
this.sprite = sprite
}

public goLeft = (): void => {
this.sprite.node.runAction(cc.moveBy(1, cc.v2(-100, 0)))
}

public goRight = (): void => {
this.sprite.node.runAction(cc.moveBy(1, cc.v2(100, 0)))
}

public goUp = (): void => {
this.sprite.node.runAction(cc.moveBy(1, cc.v2(0, 100)))
}

public goDown = (): void => {
this.sprite.node.runAction(cc.moveBy(1, cc.v2(0, -100)))
}
}

 

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: