Skip to content

Commit 0da7cf5

Browse files
committed
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.
1 parent 96711f4 commit 0da7cf5

3 files changed

Lines changed: 66 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
344344
* 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)
345345
* 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.
346346
* 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)
347+
* 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`.
347348

348349
### Updates
349350

src/Phaser.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,62 @@ var Phaser = Phaser || {
297297
*/
298298
PENDING_ATLAS: -1,
299299

300+
/**
301+
* The Angle (in degrees) a Game Object needs to be set to in order to face up.
302+
* @constant
303+
* @type {integer}
304+
*/
305+
ANGLE_UP: 270,
306+
307+
/**
308+
* The Angle (in degrees) a Game Object needs to be set to in order to face down.
309+
* @constant
310+
* @type {integer}
311+
*/
312+
ANGLE_DOWN: 90,
313+
314+
/**
315+
* The Angle (in degrees) a Game Object needs to be set to in order to face left.
316+
* @constant
317+
* @type {integer}
318+
*/
319+
ANGLE_LEFT: 180,
320+
321+
/**
322+
* The Angle (in degrees) a Game Object needs to be set to in order to face right.
323+
* @constant
324+
* @type {integer}
325+
*/
326+
ANGLE_RIGHT: 0,
327+
328+
/**
329+
* The Angle (in degrees) a Game Object needs to be set to in order to face north east.
330+
* @constant
331+
* @type {integer}
332+
*/
333+
ANGLE_NORTH_EAST: 315,
334+
335+
/**
336+
* The Angle (in degrees) a Game Object needs to be set to in order to face north west.
337+
* @constant
338+
* @type {integer}
339+
*/
340+
ANGLE_NORTH_WEST: 225,
341+
342+
/**
343+
* The Angle (in degrees) a Game Object needs to be set to in order to face south east.
344+
* @constant
345+
* @type {integer}
346+
*/
347+
ANGLE_SOUTH_EAST: 45,
348+
349+
/**
350+
* The Angle (in degrees) a Game Object needs to be set to in order to face south west.
351+
* @constant
352+
* @type {integer}
353+
*/
354+
ANGLE_SOUTH_WEST: 135,
355+
300356
/**
301357
* Various blend modes supported by Pixi.
302358
*

typescript/phaser.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ declare module "phaser" {
5353
static UP: number;
5454
static DOWN: number;
5555

56+
static ANGLE_UP: number;
57+
static ANGLE_DOWN: number;
58+
static ANGLE_LEFT: number;
59+
static ANGLE_RIGHT: number;
60+
static ANGLE_NORTH_EAST: number;
61+
static ANGLE_NORTH_WEST: number;
62+
static ANGLE_SOUTH_EAST: number;
63+
static ANGLE_SOUTH_WEST: number;
64+
5665
}
5766

5867
export module Phaser {

0 commit comments

Comments
 (0)