phaser游戏

站点: 聚观点-创意编程
课程: 必修1. 互联网创意编程基础
图书: phaser游戏
打印: 访客用户
日期: 2024年05月4日 Saturday 15:07

2. 设置

📖


3. 场景

📖

3.1. 设置载入网址

📖


▶️运行示例代码


3.2. 载入图片

📖


3.3. 添加矩形

📖


▶️运行代码

3.4. 添加精灵

📖

4. 动作

📖

6. 交互

键盘、鼠标、触摸屏等输入设备

6.1. 启用对象的拖放

Phaser.Input.InputPlugin

gameScene.input.setDraggable(gameObject)


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();

    });