phaser/README.md

113 lines
6.7 KiB
Markdown
Raw Normal View History

2016-06-16 11:33:09 +00:00
# Phaser - HTML5 Game Framework
2015-01-05 16:30:22 +00:00
2024-09-05 12:30:28 +00:00
![Phaser Banner](changelog/assets/phaser-banner.png "Phaser Banner")
2015-01-06 02:26:03 +00:00
2024-06-21 15:53:59 +00:00
[![Discord](https://img.shields.io/discord/244245946873937922?style=for-the-badge)](https://discord.gg/phaser)
![JSDelivr](https://img.shields.io/jsdelivr/npm/hm/phaser?style=for-the-badge)
2024-02-02 14:49:52 +00:00
![GitHub](https://img.shields.io/github/downloads/phaserjs/phaser/total?style=for-the-badge)
2020-01-29 17:21:03 +00:00
2024-09-05 12:45:28 +00:00
Phaser is a fast, free, and fun open source HTML5 game framework that offers WebGL and Canvas rendering across desktop and mobile web browsers and has been actively developed for over 10 years.
2024-11-14 16:34:01 +00:00
Games can be built for the web, or as YouTube Playables, Discord Activities, Twitch Overlays or compiled to iOS, Android, Steam and native apps using 3rd party tools. You can use JavaScript or TypeScript for development. Phaser supports over 40 different front-end frameworks including React and Vue.
2018-02-13 05:25:25 +00:00
2024-09-05 12:30:28 +00:00
Phaser is commercially developed and maintained by **Phaser Studio Inc** along with our fantastic open source community. As a result of rapid support, and a developer friendly API, Phaser is currently one of the [most starred](https://github.com/collections/javascript-game-engines) game frameworks on GitHub.
2015-01-06 05:47:51 +00:00
2024-09-05 12:30:28 +00:00
Interested in learning more? Click the image below to watch our intro video.
2023-04-12 18:47:27 +00:00
2024-09-05 12:45:28 +00:00
[![YouTube](http://i.ytimg.com/vi/jHTRu4iNTcA/maxresdefault.jpg)](https://www.youtube.com/watch?v=jHTRu4iNTcA)
2015-01-06 06:20:46 +00:00
2024-11-14 16:34:01 +00:00
## v4 Beta Release
2013-05-16 01:36:58 +00:00
2024-11-14 16:34:01 +00:00
You are looking at the Beta Release of Phaser v4. There are large internal differences between Phaser v3 and v4, although the public API has remained largely, but not entirely, the same.
2024-11-14 16:34:01 +00:00
Please only use this release if you wish to help beta test Phaser v4.
2015-03-26 02:10:57 +00:00
2024-11-14 17:24:00 +00:00
Phaser v4 contains Phaser Beam, our brand-new and highly efficient WebGL renderer. Virtually the entire renderer from v3 has been replaced and this transition will be documented in its own Change Log.
Other changes also include the following:
2024-11-14 17:13:39 +00:00
2024-11-14 17:21:19 +00:00
✔️ We have removed `Phaser.Struct.Set` and replaced it with a regular JS `Set` instance. This means methods like `iterateLocal` are gone.
✔️ We have removed the `Create.GenerateTexture` function and all of the Create Palettes and the `create` folder.
✔️ `TextureManager.generate` has been removed as a result of the GenerateTexture removal.
✔️ We have removed the `phaser-ie9.js` entry-point.
2024-11-14 18:01:55 +00:00
✔️ We have removed `Math.SinCosTableGenerator`.
2024-11-14 17:21:19 +00:00
✔️ We have removed the following polyfills: Array.forEach, Array.isArray, AudioContextMonkeyPatch, console, Math.trunc, performance.now, requestAnimationFrame and Uint32Array.
✔️ We have removed the Facebook Plugin detection constants from the core library.
✔️ We have removed the Camera3D Plugin.
✔️ We have removed the Layer3D Plugin.
* The `Geom.Point` class and all related functions will be removed. All functionality for this can be found in the existing Vector2 math classes. All Geometry classes that currently create and return Point objects will be updated to return Vector2 objects instead.
2024-11-14 17:52:55 +00:00
* We are removing `Phaser.Struct.Map` and replacing it with a regular JS `Map` instance. This means methods like `contains` and `setAll` will be gone.
2024-11-14 17:21:19 +00:00
* The Spine 3 and Spine 4 plugins will no longer be updated. You should now use the official Phaser Spine plugin created by Esoteric Software.
2024-11-14 17:13:39 +00:00
2024-11-14 17:52:55 +00:00
`Point.Ceil` = `Vector2.ceil`
`Point.Floor` = `Vector2.floor`
`Point.Clone` = `Vector2.clone`
`Point.CopyFrom(src,dest)` = `dest.copy(src)`
`Point.Equals` = `Vector2.equals`
`Point.GetCentroid` = `Math.GetCentroid`
`Point.GetMagnitude` = `Vector2.length`
`Point.GetMagnitudeSq` = `Vector2.lengthSq`
`Point.Invert` = `Vector2.invert`
`Point.Negative` = `Vector2.negate`
`Point.SetMagnitude` = `Vector2.setLength`
`Point.Project` = `Vector2.project`
`Point.ProjectUnit` = `Vector2.projectUnit`
2024-11-14 18:01:55 +00:00
`Point.Interpolate` = `Math.LinearXY`
`Point.GetRectangleFromPoints` = `Math.GetVec2Bounds`
2024-11-14 17:52:55 +00:00
* `Vector2.ceil` is a new method that will apply Math.ceil to the x and y components of the vector. Use as a replacement for `Geom.Point.Ceil`.
* `Vector2.floor` is a new method that will apply Math.floor to the x and y components of the vector. Use as a replacement for `Geom.Point.Floor`.
* `Vector2.invert` is a new method that will swap the x and y components of the vector. Use as a replacement for `Geom.Point.Invert`.
* `Vector2.projectUnit` is a new method that will calculate the vector projection onto a non-zero target vector. Use as a replacement for `Geom.Point.ProjectUnit`.
2024-11-14 18:01:55 +00:00
* `Math.GetCentroid` is a new function that will get the centroid, or geometric center, of a plane figure from an array of Vector2 like objects. Use as a replacement for `Geom.Point.GetCentroid`.
* `Math.GetVec2Bounds` is a new function that will get the AABB bounds as a Geom.Rectangle from an array of Vector2 objects. Use as a replacement for `Geom.Point.GetRectangleFromPoints`.
2024-11-14 17:52:55 +00:00
2024-09-05 12:30:28 +00:00
## Installing Phaser from NPM
2018-03-05 12:43:50 +00:00
2024-09-05 12:45:28 +00:00
Install via [npm](https://www.npmjs.com/package/phaser):
2018-02-13 05:25:25 +00:00
2024-09-05 12:30:28 +00:00
```bash
2024-11-14 16:34:01 +00:00
npm install phaser@beta
2024-09-05 12:45:28 +00:00
```
2024-09-05 12:30:28 +00:00
## Phaser TypeScript Definitions
2018-03-30 14:24:00 +00:00
2024-09-05 12:45:28 +00:00
Full TypeScript definitions can be found inside the [types folder](https://github.com/phaserjs/phaser/tree/master/types). They are also referenced in the `types` entry in `package.json`, meaning modern editors such as VSCode will detect them automatically.
2019-06-27 15:39:48 +00:00
Depending on your project, you may need to add the following to your `tsconfig.json` file:
```json
2022-11-22 21:55:20 +00:00
"lib": ["es6", "dom", "dom.iterable", "scripthost"],
"typeRoots": ["./node_modules/phaser/types"],
"types": ["Phaser"]
2019-06-27 15:39:48 +00:00
```
2018-03-30 14:24:00 +00:00
2024-09-05 12:45:28 +00:00
## Have fun!
2013-04-12 16:19:56 +00:00
2024-09-05 12:30:28 +00:00
Grab the source and join the fun!
2024-09-05 12:30:28 +00:00
Phaser wouldn't have been possible without the fantastic support of the community. Thank you to everyone who supports our work, who shares our belief in the future of HTML5 gaming, and Phaser's role in that.
2015-01-03 01:31:42 +00:00
2024-09-05 12:30:28 +00:00
Happy coding everyone!
2013-04-12 16:19:56 +00:00
2024-09-05 12:30:28 +00:00
Cheers,
2013-04-12 16:38:44 +00:00
2024-09-05 12:45:28 +00:00
[Rich](mailto:rich@phaser.io) and the whole team at Phaser Studio
2024-09-05 12:30:28 +00:00
![boogie](https://www.phaser.io/images/spacedancer.gif)
2013-04-12 16:19:56 +00:00
2024-09-05 12:45:28 +00:00
**Visit** the [Phaser website](https://phaser.io)<br />
**Play** some [amazing games](https://phaser.io/games)<br />
2024-09-05 12:47:02 +00:00
**Learn** By browsing our [API Docs](https://newdocs.phaser.io), [Support Forum](https://phaser.discourse.group/) and [StackOverflow](https://stackoverflow.com/questions/tagged/phaser-framework)<br />
2024-09-05 12:45:28 +00:00
**Code Examples?** We've over 2000 [Examples](https://phaser.io/examples) to learn from<br />
2024-10-11 13:32:30 +00:00
**Read** the weekly [Phaser World](https://phaser.world) Newsletter<br />
2024-09-05 12:45:28 +00:00
**Be Social:** Join us on [Discord](https://discord.gg/phaser) and [Reddit](https://phaser.io/community/reddit) or follow us on [Twitter](https://twitter.com/phaser_)<br />
2024-09-05 12:30:28 +00:00
Powered by coffee, anime, pixels and love.
2015-01-06 06:20:46 +00:00
2024-02-02 14:49:52 +00:00
The Phaser logo and characters are &copy; 2011 - 2024 Phaser Studio Inc.
2015-01-06 06:20:46 +00:00
2015-01-06 05:47:51 +00:00
All rights reserved.
2013-04-12 16:19:56 +00:00
"Above all, video games are meant to be just one thing: fun. Fun for everyone." - Satoru Iwata