From 0da7cf5ffdb9036e3c2b952ef9a975050bbb8943 Mon Sep 17 00:00:00 2001 From: photonstorm Date: Fri, 3 Jun 2016 15:19:18 +0100 Subject: [PATCH] There are a bunch of new Phaser consts available to help with setting the angle of a Game Object. They are `Phaser.ANGLE_UP`, `ANGLE_DOWN`, `ANGLE_LEFT`, `ANGLE_RIGHT`, `ANGLE_NORTH_EAST`, `ANGLE_NORTH_WEST`, `ANGLE_SOUTH_EAST` and `ANGLE_SOUTH_WEST`. --- README.md | 1 + src/Phaser.js | 56 ++++++++++++++++++++++++++++++++++++++++++ typescript/phaser.d.ts | 9 +++++++ 3 files changed, 66 insertions(+) diff --git a/README.md b/README.md index b302727ac..fed4b6e5f 100644 --- a/README.md +++ b/README.md @@ -344,6 +344,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/ * The way the display list updates and Camera movements are handled has been completely revamped, which should result is significantly smoother motion when the Camera is following tweened or physics controlled sprites. The `Stage.postUpdate` function is now vastly reduced in complexity. It takes control over updating the display list (calling `updateTransform` on itself), rather than letting the Canvas or WebGL renderers do this. Because of this change, the `Camera.updateTarget` function uses the Sprites `worldPosition` property instead, which is now frame accurate (thanks @whig @Upperfoot @Whoisnt @hexus #2482) * Game Objects including Sprite, Image, Particle, TilemapLayer, Text, BitmapText and TileSprite have a new property called `data`. This is an empty Object that Phaser will never touch internally, but your own code, or Phaser Plugins, can store Game Object specific data within it. This allows you to associate data with a Game Object without having to pollute or change its class shape. * TilemapLayers will now collide properly when they have a position that isn't set to 0x0. For example if you're stitching together several maps, one after the other, and manually adjust their `scrollX/Y` properties (thanks @Upperfoot #2522) +* There are a bunch of new Phaser consts available to help with setting the angle of a Game Object. They are `Phaser.ANGLE_UP`, `ANGLE_DOWN`, `ANGLE_LEFT`, `ANGLE_RIGHT`, `ANGLE_NORTH_EAST`, `ANGLE_NORTH_WEST`, `ANGLE_SOUTH_EAST` and `ANGLE_SOUTH_WEST`. ### Updates diff --git a/src/Phaser.js b/src/Phaser.js index 424995bd7..c5ba67914 100644 --- a/src/Phaser.js +++ b/src/Phaser.js @@ -297,6 +297,62 @@ var Phaser = Phaser || { */ PENDING_ATLAS: -1, + /** + * The Angle (in degrees) a Game Object needs to be set to in order to face up. + * @constant + * @type {integer} + */ + ANGLE_UP: 270, + + /** + * The Angle (in degrees) a Game Object needs to be set to in order to face down. + * @constant + * @type {integer} + */ + ANGLE_DOWN: 90, + + /** + * The Angle (in degrees) a Game Object needs to be set to in order to face left. + * @constant + * @type {integer} + */ + ANGLE_LEFT: 180, + + /** + * The Angle (in degrees) a Game Object needs to be set to in order to face right. + * @constant + * @type {integer} + */ + ANGLE_RIGHT: 0, + + /** + * The Angle (in degrees) a Game Object needs to be set to in order to face north east. + * @constant + * @type {integer} + */ + ANGLE_NORTH_EAST: 315, + + /** + * The Angle (in degrees) a Game Object needs to be set to in order to face north west. + * @constant + * @type {integer} + */ + ANGLE_NORTH_WEST: 225, + + /** + * The Angle (in degrees) a Game Object needs to be set to in order to face south east. + * @constant + * @type {integer} + */ + ANGLE_SOUTH_EAST: 45, + + /** + * The Angle (in degrees) a Game Object needs to be set to in order to face south west. + * @constant + * @type {integer} + */ + ANGLE_SOUTH_WEST: 135, + /** * Various blend modes supported by Pixi. * diff --git a/typescript/phaser.d.ts b/typescript/phaser.d.ts index faf959faa..f04f98c68 100644 --- a/typescript/phaser.d.ts +++ b/typescript/phaser.d.ts @@ -53,6 +53,15 @@ declare module "phaser" { static UP: number; static DOWN: number; + static ANGLE_UP: number; + static ANGLE_DOWN: number; + static ANGLE_LEFT: number; + static ANGLE_RIGHT: number; + static ANGLE_NORTH_EAST: number; + static ANGLE_NORTH_WEST: number; + static ANGLE_SOUTH_EAST: number; + static ANGLE_SOUTH_WEST: number; + } export module Phaser {