有不懂的可以来问的呦,抓娃娃全程,前提你自己加载了js资源

下边就是全过程了

var config = {

    type: Phaser.AUTO,

    width: 375,

    height: 667,

    parent:'game',

    physics: {

        default: 'arcade',

        arcade: {

            gravity: { y: 0 },

            debug: false

        }

    },

    scale:{

        orientation:"landscape"

    },

    audio: {

        noAudio: false

    },

    scene: {

        preload: preload,

        create: create,

        update: update

    }

};

var game = new Phaser.Game(config);

function preload ()

{

    // 加载图片资源

    this.load.image('gameBg', 'aa.png');//背景图片

    this.load.image('gameStart', aa.png');//开始按钮

    this.load.image('quickZhua', aa.png');//立即按钮

    this.load.image('gift1', 'aa.png');

    this.load.image('gift2','aa.png');

}

function create (){

   

    const that=this

    // 添加静态资源

let gameBg=this.add.image(0, 0, 'gameBg').setOrigin(0, 0).setScale(0.5);//背景图

 player = this.physics.add.sprite(200, 60+80, 'dude').setScale(0.5);

// 设置渲染顺序为最上层

player.setDepth(100);

player.setCollideWorldBounds(true);//控制掉到下边

// 向下的速度,数字越大下落越快

player.body.setGravityY(0)

console.log(player,"player")

/

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部