40phaser 中文文档教程
40Phaser
Codecademy 花哨的 schmancy 404 页面。
Usage
在 npm 上安装 40phaser
包:
npm i 40phaser
因为这个包需要图像资源,所以你需要使用像 webpack 或 rollup 来编译您在网站上使用的脚本。 此 repo 中包含使用汇总的此设置示例,并用于本地开发。
在 window.Phaser
下已经有 Phaser 的网页中,导入并调用 launch40Phaser
启动游戏的函数:
import { launch40Phaser } from "40phaser";
window.onload = () => {
launch40Phaser();
};
或者,如果 Phaser 在全局不可用,您可以将其作为 phaser
传递给游戏:可以向
import { launch40Phaser } from "40phaser";
import phaser from "phaser";
window.onload = () => {
launch40Phaser({ phaser });
};
Events
提供一个 on
对象>launch40Phaser 对象,其函数在 end
、game
和 start
下——对应于游戏中的这三个 Phaser 场景。
launch40Phaser({
on: {
game: action => console.log('[game]', action),
},
});
on.end
on.end("build-your-own")
: User navigates to the the Learn Phaser courseon.end("game")
: User restarts the game
on.game
on.game("death")
: User dies by falling through the flooron.game("jump")
: User requests to jumpon.game("pause")
: User unpauseson.game("unpause")
: User pauses
on.start
on.start("build-your-own")
: User navigates to the Learn Phaser courseon.start("contribute")
: User navigates to the GitHub repositoryon.start("game")
: User starts the game
Development
请参阅 Development.md! ✨
Contribution Guidelines
我们很乐意让您做出贡献! 检查问题跟踪器是否有标记为接受 PR 以查找错误修复和社区可以处理的功能请求。 如果这是您第一次使用此代码,Good First issue 标签表示良好的介绍性问题。
请注意,此项目随 贡献者契约 一起发布。 参与此项目即表示您同意遵守其条款。 请参阅 CODEOFCONDUCT.md。
40Phaser
Codecademy's fancy schmancy 404 page.
Usage
Install the 40phaser
package on npm:
npm i 40phaser
Because this package requires image assets, you'll need to use a bundler like webpack or rollup to compile the script you use on your site. An example of this setup using rollup is included in this repo and used for local development.
In a webpage that already has Phaser available under window.Phaser
, import and call the launch40Phaser
function to start the game:
import { launch40Phaser } from "40phaser";
window.onload = () => {
launch40Phaser();
};
Alternately, if Phaser isn't available globally, you may pass it to the game as phaser
:
import { launch40Phaser } from "40phaser";
import phaser from "phaser";
window.onload = () => {
launch40Phaser({ phaser });
};
Events
An on
object may be provided to the launch40Phaser
object with functions under end
, game
, and start
-- corresponding to those three Phaser scenes in the game.
launch40Phaser({
on: {
game: action => console.log('[game]', action),
},
});
on.end
on.end("build-your-own")
: User navigates to the the Learn Phaser courseon.end("game")
: User restarts the game
on.game
on.game("death")
: User dies by falling through the flooron.game("jump")
: User requests to jumpon.game("pause")
: User unpauseson.game("unpause")
: User pauses
on.start
on.start("build-your-own")
: User navigates to the Learn Phaser courseon.start("contribute")
: User navigates to the GitHub repositoryon.start("game")
: User starts the game
Development
See Development.md! ✨
Contribution Guidelines
We'd love to have you contribute! Check the issue tracker for issues labeled Accepting PRs to find bug fixes and feature requests the community can work on. If this is your first time working with this code, the Good First issue label indicates good introductory issues.
Please note that this project is released with a Contributor Covenant. By participating in this project you agree to abide by its terms. See CODEOFCONDUCT.md.
你可能也喜欢
- 1ba2d7b199994c1bad0767d0f4cbdcca 中文文档教程
- 42-cent-authorizenet 中文文档教程
- @0saw/foundation-media-query 中文文档教程
- @100daysofdischarge/salad.js 中文文档教程
- @3cplus/3cplusv2-sdk 中文文档教程
- @aboutweb/irrigable 中文文档教程
- @absolunet/kafe 中文文档教程
- @acceleratxr/passport-oauth2 中文文档教程
- @acoustic-content-sdk/ng-app-live 中文文档教程
- @acoustic-content-sdk/ng-edit 中文文档教程