phaser2小游戏基本没什么什么问题,可以下常开发游戏.如果遇到什么问题, 可以提出来共同讨论.

下面来个例子

import './lib/weapp-adapter';
import Phaser from './lib/phaser'; let systemInfo = wx.getSystemInfoSync();
let {windowWidth, windowHeight, pixelRatio} = systemInfo; var config = {
width: windowWidth * pixelRatio,
height: windowHeight * pixelRatio,
renderer: Phaser.WEBGL,
antialias: true,
multiTexture: true,
resolution:1,
canvas:canvas
} let game = new Phaser.Game(config);
game.state.add("boot", Boot, true); function Boot() { } Boot.prototype.preload = function() {
game.input.scale.x = pixelRatio;
game.input.scale.y = pixelRatio;
this.load.baseURL = "assets/";
game.load.image("crate", "crate.png");
} Boot.prototype.create = function() {
// adding P2 physics to the game
game.physics.startSystem(Phaser.Physics.P2JS);
// setting gravity
game.physics.p2.gravity.y = 250;
// adding event listener for mousedown/touch event
game.input.onDown.add(this.addRemove, this);
} Boot.prototype.addRemove = function(pointer){
// checking for bodies under the mouse
var bodyClicked = game.physics.p2.hitTest(pointer.position);
if (bodyClicked.length==0){
// creation of physics body and its graphic asset
var crate = game.add.sprite(pointer.position.x, pointer.position.y, "crate");
game.physics.p2.enable(crate);
}
else{
// destruction of physics body and its graphic asset
bodyClicked[0].parent.sprite.kill();
}
};

基于一般的全屏小游戏的宽高是640,高度是动态的.这里也是需要做下处理的

import './lib/weapp-adapter';
import Phaser from './lib/phaser'; let systemInfo = wx.getSystemInfoSync();
let {windowWidth, windowHeight, pixelRatio} = systemInfo;
let width = 640;
let height = 640 * windowHeight / windowWidth; var config = {
width,
height,
renderer: Phaser.WEBGL,
antialias: true,
multiTexture: true,
resolution:1,
canvas:canvas
} let game = new Phaser.Game(config);
game.state.add("boot", Boot, true); function Boot() { } Boot.prototype.preload = function() {
game.input.scale.x = config.width / windowWidth;
game.input.scale.y = config.height / windowHeight;
this.load.baseURL = "assets/";
game.load.image("crate", "crate.png");
} Boot.prototype.create = function() {
// adding P2 physics to the game
game.physics.startSystem(Phaser.Physics.P2JS);
// setting gravity
game.physics.p2.gravity.y = 250;
// adding event listener for mousedown/touch event
game.input.onDown.add(this.addRemove, this);
} Boot.prototype.addRemove = function(pointer){
// checking for bodies under the mouse
var bodyClicked = game.physics.p2.hitTest(pointer.position);
if (bodyClicked.length==0){
// creation of physics body and its graphic asset
var crate = game.add.sprite(pointer.position.x, pointer.position.y, "crate");
game.physics.p2.enable(crate);
}
else{
// destruction of physics body and its graphic asset
bodyClicked[0].parent.sprite.kill();
}
};

phaser开发小游戏一点问题都没,笔者已经用phaser开发三款小游戏。没有遇到什么大问题...

声音的话,sound.play方法,然后用wx的播放声音的方法代替.

github:  https://gitee.com/redw1234567/phaser-ce

有问题留言或 QQ群  881784250. 谢谢~~~

phaser2 微信小游戏入手的更多相关文章

  1. pixi.js 微信小游戏 入手

    pixi是什么?一款h5游戏引擎 优点:简单简洁性能第一 缺点:大多数用的国产三大引擎,pixi资料少,工具少, 为什么学,装逼 用pixi开发小游戏行吗? 行.但要简单处理下 下载官网上的 weap ...

  2. 没玩过这些微信小游戏你就out了

    你确定没玩过下面这些微信小游戏?是不是有点out了?赶紧添加微信号kangfuyk,回复H5马上畅玩! 当然了,扫一下二维码关注后回复H5更快捷噢! 微信小游戏列表,持续更新中 辨色大比拼!心理游戏 ...

  3. 【转】微信小游戏接入Fundebug监控

    在SegmentFault上看到Fundebug上线小游戏监控,刚好最近开始玩微信小游戏,于是尝试接入试了一下. 接入方法 创建项目的时候选择左下角的微信小游戏图标. 点击继续进入接入插件页面. 第三 ...

  4. 【转】Fundebug上线微信小游戏错误监控!支持自动截屏!

    摘要: Fundebug竭诚为你的小游戏保驾护航. 想必大家都玩过"跳一跳"吧?刷排行榜的感觉是不是很好啊!还有"知乎答题王"呢,在智力上碾压老铁简直太棒了! ...

  5. 【转】利用 three.js 开发微信小游戏的尝试

    前言 这是一次利用 three.js 开发微信小游戏的尝试,并不能算作是教程,只能算是一篇笔记吧. 微信 WeChat 6.6.1 开始引入了微信小游戏,初期上线了一批质量相当不错的小游戏.我在查阅各 ...

  6. 微信小游戏开发之四:使用three.js引擎

    一.前言 微信小游戏中最魔性的'跳一跳'就是基于three.js 引擎开发的 源码放到github上了:GitHub地址   请自行下载. 二.下载 three.min.js 打开页面,复制代码到本地 ...

  7. 微信小游戏开发Canvas资源汇总

    Demo: 微信小程序demo组件:股票分时图 微信小程序小组件:仿直播点赞气泡效果,基于Canvas 优质demo推荐:二维码生成器:使用canvas与纯JS版二维码生成 微信小程序学习用完整dem ...

  8. 微信小游戏爆款秘笈 数据库MongoDB攻略篇

    欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 本文由腾讯云数据库 TencentDB 发表于云+社区专栏 随着微信小游戏的爆发,越来越多开发者关注到MongoDB与小游戏业务的契合度. ...

  9. Egret 生成 自带EUI 的微信小游戏 踩坑!

    1. 首先,再次被网上一大堆屎一样的资料搞得浪费了我一天时间.各种坑. 2. 本文先讲一种正确的方式,然后再列举坑. 去www.egret.com下载最新的引擎,我的最新版本是5.2.2. 然后就会被 ...

随机推荐

  1. HTTP1.0,HTTP1.1,HTTP2.0的主要特征对比

    HTTP1.0 是一种无状态.无连接的应用层协议. HTTP1.0规定浏览器和服务器保持短暂的连接,浏览器的每次请求都需要与服务器建立一个TCP连接,服务器处理完成后立即断开TCP连接(无连接),服务 ...

  2. 【翻译】理解 LSTM 网络

    目录 理解 LSTM 网络 递归神经网络 长期依赖性问题 LSTM 网络 LSTM 的核心想法 逐步解析 LSTM 的流程 长短期记忆的变种 结论 鸣谢 本文翻译自 Christopher Olah ...

  3. SAP 直接修改程序的方法

    一般项目上都会有这么个神奇的程序,能在测试机和生产机上直接修改程序... REPORT ztest_change. "变量定义 , line() TYPE c, "如果代码中某行大 ...

  4. Oracle入门第三天(上)——多表查询与分组函数

    一.多表查询 所有的连接分析,参考之前随笔:http://www.cnblogs.com/jiangbei/p/7420136.html 1.笛卡尔积 select last_name, depart ...

  5. 20155321 《Java程序设计》实验三 敏捷开发与XP实践

    实验内容 XP基础 XP核心实践 相关工具 实验步骤 敏捷开发与XP 软件工程是把系统的.有序的.可量化的方法应用到软件的开发.运营和维护上的过程.软件工程包括下列领域:软件需求分析.软件设计.软件构 ...

  6. 【POI2007】ZAP-Queries

    题面 题解 $$ \sum_{i=1}^a\sum_{j=1}^b[gcd(i,\;j)=d] \\ =\sum_{i=1}^{\left\lfloor\frac ad\right\rfloor}\s ...

  7. CF161D Distance in Tree

    CF161D Distance in Tree LG传送门 长链剖分板子题. 长链剖分那么好写,跑得又快,为什么要写点分治呢?完了我现在看一道点分治题就想写长链剖分 如果还不会长链剖分请看我博客. 没 ...

  8. Drupal7 实现like(点赞)功能

    尝试了好几个模块做下总结: 1. Like Dislike Buttons 好处:代码实现简单,一看就懂,开启后无需任何配置,自动在node底部显示like和unlike的小手.而且模版改起来也容易. ...

  9. 无旋treap的区间操作实现

    最近真的不爽...一道维修数列就做了我1上午+下午1h+1晚上+晚上1h+上午2h... 一道不错的自虐题... 由于这一片主要讲思想,代码我放这里了 不会无旋treap的童鞋可以进这里 呵呵... ...

  10. Spring学习(六)-----Spring使用@Autowired注解自动装配

    Spring使用@Autowired注解自动装配 在上一篇 Spring学习(三)-----Spring自动装配Beans示例中,它会匹配当前Spring容器任何bean的属性自动装配.在大多数情况下 ...