初学Phaser.js之添加菜单与移动端点击

今天接着学Phaser.js,写接元宝游戏,由于最后要放到移动端去玩,所以今天对游戏做出如下完善:

1.将game宽高改为百分比,适配屏幕

2.新增game.input.onDown来监听移动端触碰,本来在搜touch系事件,后来在stackoverflow上看了几个回答都一直推荐onDown。就去看文档然后就写出来了。

Phaser.Input.onDown.add介绍如下:

A Signal is used for object communication via a custom broadcaster instead of Events.

class Phaser.Signal {

    Add a listener to the signal.

        arg function listener

            The function to call when this Signal is dispatched.

        arg object listenerContext (optional)

            The context under which the listener will be executed (i.e. the object that should represent the `this` variable).

        arg number priority (optional)

            The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower pr
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值