Phaser.js All In One
Phaser.js All In One
HTML5 Canvas 2D Game Engine
Phaser.js
Phaser 3
https://github.com/photonstorm/phaser
https://www.npmjs.com/package/phaser
https://github.com/photonstorm/phaser3-examples
$ yarn add -D phaser
$ npm i phaser
Phaser CE / Phaser 2
https://github.com/photonstorm/phaser-ce
https://www.npmjs.com/package/phaser-ce
$ yarn add -D phaser-ce
$ npm i phaser-ce
https://github.com/photonstorm/phaser-ce/tree/master/typescript
https://github.com/photonstorm/phaser-ce#webpack
https://github.com/lean/phaser-es6-webpack
PixiJS
The HTML5 Creation Engine: Create beautiful digital content with the fastest, most flexible 2D WebGL renderer.
https://github.com/pixijs/pixijs
demos
const log = console.log;
log('Hello Phaser.js 👻');
log(`\nPhaser =`, Phaser);
// Phaser = {VERSION: '2.19.2', GAMES: Array(0), AUTO: 0, CANVAS: 1, WEBGL: 2, …}
log(`Phaser.AUTO =`, Phaser.AUTO);
// 0
var game = new Phaser.Game(375, 667, Phaser.AUTO);
var gameState = {
preload: function () {
game.stage.backgroundColor = '#a8d4bf';
game.load.image('logo', './imgs/logo.png');
},
create: function () {
// var text = game.add.text(game.world.centerX, 25, 'first demo', {fill: '#fff'});
var text = game.add.text(game.world.centerX, 25, 'first demo', {fill: '#0f0'});
text.anchor.set(0.5);
var img = game.add.image(game.world.centerX, game.world.centerY, 'logo');
// 居中
img.anchor.set(0.5);
// 左上方,偏移
// img.anchor.set(0.7);
// 右下方,偏移
// img.anchor.set(0.3);
},
};
game.state.add('gameState', gameState);
game.state.start('gameState');
docs
https://photonstorm.github.io/phaser-ce/
https://github.com/photonstorm/phaser-ce/tree/master/docs
https://github.com/photonstorm/phaser-ce/blob/master/DOCS.md
https://github.com/photonstorm/phaser-ce/issues/726
微信适配版
源码构建
// globalThis ???
typeof GameGlobal
// 'undefined'
GameGlobal
// Uncaught ReferenceError: GameGlobal is not defined ❌
https://gitee.com/codeveryday/phaser-ce_wechat/commit/a9315a54245a1b280cd12a337114130298167098
refs
sandbox
©xgqfrms 2012-2025
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/16552733.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示
2021-08-05 css overflow bug All In One
2021-08-05 Windows 系统不区分文件名大小写 bug All In One
2021-08-05 Apple MBP 无法链接 AirPods 2 耳机 All In One
2020-08-05 .pyc & Python
2020-08-05 How to change Linux Terminal display username All In One
2020-08-05 SVG image tag
2020-08-05 Python Learning Paths