diff --git a/README.md b/README.md index 67dba6f8..7646e095 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Version 1.1.3 - in build * New: RenderTexture.render now takes a Phaser.Group. Also added renderXY for when you don't want to make a new Point object. * New: Implementing PluginManager.remove, added PluginManager.removeAll (thanks crazysam) * New: Added scrollFactorX/scrollFactorY to TilemapLayers (thanks jcd-as) -* New: Phaser.Game parent can now be a HTMLElement (thanks beeglebug) +* New: Phaser.Game parent can now be an HTMLElement or a string (thanks beeglebug) * New: Updated to use the latest version of Pixi.js - which means you can now use all the sexy new WebGL filters they added :) * New: Sprite.animations.getAnimation will return an animation instance which was added by name. * New: Added Mouse.button which is set to the button that was pressed: Phaser.Mouse.LEFT_BUTTON, MIDDLE_BUTTON or RIGHT_BUTTON (thanks wKLV) @@ -54,21 +54,23 @@ Version 1.1.3 - in build * New: StageScaleMode.forceOrientation allows you to lock your game to one orientation and display a Sprite (i.e. a "please rotate" screen) when incorrect. * New: World.visible boolean added, toggles rendering of the world on/off entirely. * New: Polygon class & drawPolygon method added to Graphics (thanks rjimenezda) -* New: Added Group.iterate, a powerful way to count or return child that match a certain criteria. Refactored Group to use iterate, lots of repeated code cut. +* New: Added Group.iterate, a powerful way to count or return children that match a certain criteria. Refactored Group to use iterate, lots of repeated code cut. * New: Added Group.sort. You can now sort the Group based on any given numeric property (x, y, health), finally you can do depth-sorting :) Example created to show. * New: Enhanced renderTexture so it can accept a Phaser.Group object and improved documentation and examples. +* Fixed: Lots of fixes to the TypeScript definitions file (many thanks gltovar) * Fixed: Tilemap commands use specified layer when one given (thanks Izzimach) * Fixed: Mouse.stop now uses the true useCapture, which means the event listeners stop listening correctly (thanks beeglebug) * Fixed: Input Keyboard example fix (thanks Atrodilla) * Fixed: BitmapText.destroy now checks if it has a canvas before calling parentNode on it. * Fixed: Group.swap had a hellish to find bug that only manifested when B-A upward swaps occured. Hours of debugging later = bug crushed. * Fixed: Point.rotate asDegrees fixed (thanks BorisKozo) +* Fixed: ArcadePhysics.separateTile wasn't returning the value, so the custom process callback wasn't getting called (thanks flameiguana) * Updated: ArcadePhysics.updateMotion applies the dt to the velocity calculations as well as position now (thanks jcs) * Updated: RequestAnimationFrame now retains the callbackID which is passed to cancelRequestAnimationFrame. * Updated: Button now goes back to over state when setFrames used in action (thanks beeglebug) * Updated: plugins now have a postUpdate callback (thanks cocoademon) * Updated: Tided up the Graphics object (thanks BorisKozo) -* Updated: If running in Canvas mode and you have a render function it will save the context and reset the transform before running your render function +* Updated: If running in Canvas mode and you have a render function it will save the context and reset the transform before running your render function. * Updated: Sprite will now check the exists property of the Group it is in, if the Group.exists = false the Sprite won't update. * Updated: Lots of small documentation tweaks across various files such as Pointer. * Updated: If you specify 'null' as a Group parent it will now revert to using the World as the parent (before only 'undefined' worked) diff --git a/examples/tilemaps/sci fly.js b/examples/tilemaps/sci fly.js index 76b599c1..c0e15f28 100644 --- a/examples/tilemaps/sci fly.js +++ b/examples/tilemaps/sci fly.js @@ -52,7 +52,7 @@ function create() { sprite = game.add.sprite(450, 80, 'phaser'); sprite.anchor.setTo(0.5, 0.5); - sprite.angle = 45; + // sprite.angle = 45; game.camera.follow(sprite); // game.camera.deadzone = new Phaser.Rectangle(160, 160, layer.renderWidth-320, layer.renderHeight-320); diff --git a/examples/wip/struck.js b/examples/wip/struck.js new file mode 100644 index 00000000..6943e9e0 --- /dev/null +++ b/examples/wip/struck.js @@ -0,0 +1,125 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.tilemap('level1', 'assets/games/starstruck/level1.json', null, Phaser.Tilemap.TILED_JSON); + game.load.tileset('tiles', 'assets/games/starstruck/tiles-1.png', 16, 16); + game.load.spritesheet('dude', 'assets/games/starstruck/dude.png', 32, 48); + game.load.spritesheet('droid', 'assets/games/starstruck/droid.png', 32, 32); + game.load.image('starSmall', 'assets/games/starstruck/star.png'); + game.load.image('starBig', 'assets/games/starstruck/star2.png'); + game.load.image('background', 'assets/games/starstruck/background2.png'); + +} + +var map; +var tileset; +var layer; +var player; +var facing = 'left'; +var jumpTimer = 0; +var cursors; +var jumpButton; +var bg; + +function create() { + + game.stage.backgroundColor = '#000000'; + + bg = game.add.tileSprite(0, 0, 800, 600, 'background'); + bg.fixedToCamera = true; + + map = game.add.tilemap('level1'); + + tileset = game.add.tileset('tiles'); + + tileset.setCollisionRange(0, tileset.total - 1, true, true, true, true); + + tileset.setCollisionRange(12, 16, false, false, false, false); + tileset.setCollisionRange(46, 50, false, false, false, false); + + layer = game.add.tilemapLayer(0, 0, 800, 600, tileset, map, 0); + layer.resizeWorld(); + + player = game.add.sprite(32, 32, 'dude'); + player.body.bounce.y = 0.2; + player.body.collideWorldBounds = true; + player.body.gravity.y = 6; + player.body.setSize(16, 32, 8, 16); + + player.animations.add('left', [0, 1, 2, 3], 10, true); + player.animations.add('turn', [4], 20, true); + player.animations.add('right', [5, 6, 7, 8], 10, true); + + player.angle = 45; + + game.camera.follow(player); + + cursors = game.input.keyboard.createCursorKeys(); + jumpButton = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); + +} + +function update() { + + game.physics.collide(player, layer); + + player.body.velocity.x = 0; + + if (cursors.left.isDown) + { + player.body.velocity.x = -150; + + if (facing != 'left') + { + player.animations.play('left'); + facing = 'left'; + } + } + else if (cursors.right.isDown) + { + player.body.velocity.x = 150; + + if (facing != 'right') + { + player.animations.play('right'); + facing = 'right'; + } + } + else + { + if (facing != 'idle') + { + player.animations.stop(); + + if (facing == 'left') + { + player.frame = 0; + } + else + { + player.frame = 5; + } + + facing = 'idle'; + } + } + + if (jumpButton.isDown && player.body.touching.down && game.time.now > jumpTimer) + { + player.body.velocity.y = -250; + jumpTimer = game.time.now + 750; + } + + // player.scale.x += 0.001; + // player.scale.y += 0.001; + +} + +function render () { + + game.debug.renderCameraInfo(game.camera, 32, 32); + game.debug.renderSpriteBody(player); + +} diff --git a/src/physics/arcade/ArcadePhysics.js b/src/physics/arcade/ArcadePhysics.js index 533461b3..467832e1 100644 --- a/src/physics/arcade/ArcadePhysics.js +++ b/src/physics/arcade/ArcadePhysics.js @@ -302,8 +302,8 @@ Phaser.Physics.Arcade.prototype = { }, /** - * Checks for collision between two game objects. The objects can be Sprites, Groups, Emitters or Tilemaps. - * You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap or Group vs. Tilemap collisions. + * Checks for collision between two game objects. The objects can be Sprites, Groups, Emitters or Tilemap Layers. + * You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap Layer or Group vs. Tilemap Layer collisions. * The objects are also automatically separated. * * @method Phaser.Physics.Arcade#collide @@ -838,6 +838,8 @@ Phaser.Physics.Arcade.prototype = { this._result = (this.separateTileX(body, tile, true) || this.separateTileY(body, tile, true)); + return this._result; + }, /**