phaser游戏
| 站点: | 聚观点-集成开发环境 |
| 课程: | 必修1. 互联网创意编程基础 |
| 图书: | phaser游戏 |
| 打印: | 访客用户 |
| 日期: | 2026年01月28日 星期三 17:26 |
1. Game


设置:JSON文本,例如
{backgroundColor: '#2d2d2d', pixelArt: true}


3. 场景
3.4. 添加精灵
4. 动作
6. 交互
键盘、鼠标、触摸屏等输入设备
6.2. 当拖放时
this.input.on('dragstart', function (pointer, gameObject) {
gameObject.setTint(0xff0000);
});
this.input.on('drag', function (pointer, gameObject, dragX, dragY) {
gameObject.x = dragX;
gameObject.y = dragY;
});
this.input.on('dragend', function (pointer, gameObject) {
gameObject.clearTint();
});




