Commit graph

99 commits

Author SHA1 Message Date
photonstorm
f4eff6359c Added isArray check. 2015-03-05 14:02:24 +00:00
photonstorm
a69e53f901 Copyright date change. 2015-02-25 03:36:23 +00:00
photonstorm
35a04b2f1e TilemapParser now supports Tiled 0.11 version maps which includes the rotation property on all Object types.
Tilemap.createFromObjects now checks for a `rotation` property on the Object and if present will set it as the Sprite.angle (#1433)
2015-02-08 23:25:41 +00:00
photonstorm
6d86952f98 JSDoc fix. 2015-02-08 21:57:09 +00:00
photonstorm
6d967b6545 Error in diffX and diffY calculation in Tilemap.paste (thanks @amelia410 #1446) 2015-01-20 10:49:15 +00:00
photonstorm
a2aa987920 jshint fixes 2014-11-11 01:09:57 +00:00
photonstorm
a2b7d339a2 Tilemap.createFromTiles will convert all tiles matching the given tile index (or an array of indexes) into Sprites. You can optionally then replace these tiles if you wish. This is perfect for games when you want to turn specific tiles into Sprites for extra control. The Sprites have an optional properties object which they can be populated with. 2014-11-11 01:05:59 +00:00
photonstorm
410cfd2d71 Code reformatting. 2014-08-29 18:06:01 +01:00
photonstorm
2d4d1a050d Tilemap.hasTile now checks the Tile.index value and will return false if the index is -1 (i.e. a non-active tile) (thanks @elgansayer #859) 2014-08-28 04:30:13 +01:00
photonstorm
9c1f39d284 jshint fix 2014-07-18 01:07:45 +01:00
photonstorm
49bb45c42e Tilemap.swap now accurately swaps from A to B and from B to A (thanks @noidexe #1034) 2014-07-18 00:29:24 +01:00
sivael
cdaab269a0 Update Tilemap.js 2014-06-27 14:36:06 +02:00
sivael
7fb5c8cf5d Update Tilemap.js 2014-06-27 14:25:56 +02:00
sivael
c7cae6ece7 Update Tilemap.js 2014-06-27 14:21:45 +02:00
sivael
05ce6f60a1 TileMap update performance
Discussion: http://www.html5gamedevs.com/topic/7409-tilemaps-changing/

It should remove the problem of updating stuff in a 100x100 tilemap making the engine recalculate every single update.(390 tiles changed in that map makes it a 100x100x390 loop.
Whould make the recalculate parameter in the setCollision functions unnecessary as well.
2014-06-27 14:10:11 +02:00
JeanDavidDaviet
a4b279b9cc updated doc for Phaser.Tilemap#createBlankLayer 2014-06-04 19:01:10 +10:00
Simon Boyé
7e43248412 Fixed Tilemap.removeTile issue to put tile of index -1 instead of null. 2014-05-19 22:58:52 +02:00
photonstorm
cfadaf3e70 Tilemap.layer is a getter/setter to the current layer object (which can be changed with Tilemap.setLayer) 2014-05-15 22:30:32 +01:00
photonstorm
1d13855abb Tilemap.searchTileIndex allows you to search for the first tile matching the given index, with optional skip and reverse parameters. 2014-05-15 19:56:56 +01:00
Maximilian Mader
d7ba7b3a62 Improve TileMap's setCollsion functions
Now one can decide in 'setCollision', 'setCollisionBetween', 'setCollisionByExclusion' and 'setCollisionByIndex' to recalculate the collision faces or not.

I was able to decrease the time it takes to set the collisions from 1880ms to 440ms in my case,see http://www.html5gamedevs.com/topic/6328-camera-rendered-area-move-tilemaplayer/?p=38037
2014-05-12 17:42:54 +02:00
photonstorm
041bbd430c Tilemap.getTile has a new nonNull parameter. If true it won't return null for empty tiles, but will return the actual Tile in that location. 2014-05-07 01:30:48 +01:00
photonstorm
91f8f96a76 TilemapWalker allows you to set a location marker into a tilemap. You can then move around with commands such as moveForward, turnLeft, etc.
New consts: Phaser.Tilemap.NORTH, SOUTH, EAST and WEST to use with the TileMapWalker Plugin.
2014-05-07 00:10:48 +01:00
photonstorm
422e769a3e Tilemap.createFromObjects will now force the creation of the property again even if it doesn't exist (regression fix from 2.0.4) 2014-05-01 11:42:15 +01:00
photonstorm
55dc748953 Tilemap.getTile and getTileXY used to return null in 2.0.3 but returned a Tile object in 2.0.4 (with an index of -1), they now return null again. 2014-04-29 21:28:14 +01:00
photonstorm
74108148ac CSV Tilemap tiles would incorrectly set the Tile layer reference, causing collision to fail (thanks @Chapelin, fix #692) 2014-04-28 23:21:57 +01:00
photonstorm
e9436293a8 Tilemap.addTilesetImage will now raise a console.warn if you specify an invalid tileset key and not create the tileset rather than pick the default set. 2014-04-28 13:47:27 +01:00
photonstorm
65022ccc55 Blank Tilemaps no longer create null tiles, but instead create Tile objects with an index of -1 which can be replaced and updated like any other tile.
Tilemap.fill would throw an error if called on a blank tilemap full of null values (thanks @DrHackenstein, fix #761)
2014-04-28 02:42:38 +01:00
photonstorm
b1153299c0 Tilemap.fill would throw an error if called on a blank tilemap full of null values (thanks @DrHackenstein, fix #761) 2014-04-28 02:23:07 +01:00
photonstorm
1ef617ca82 Updated Tilemap.destroy documentation to clarify layer removal (issue #740) 2014-04-28 01:39:45 +01:00
Raeven0
7fa9e4639e correct Tilemap.hasTile(...) parameter typing
Member methods of Tilemap which take a layer parameter use getLayer on
that parameter to allow passing int, string, and TilemapLayer objects.
Tilemap.hasTile(...) should do so as well.
2014-04-01 20:26:16 -05:00
photonstorm
38d722c1e5 Tilemap.removeTile(x, y, layer) lets you remove the tile at the given coordinates and updates the collision data.
Tilemap.removeTileWorldXY lets you remove the tile at the given pixel value coordinates and updates the collision data.
If you pass `null` to Tilemap.putTile as the tile parameter it will pass the call over to Tilemap.removeTile.
2014-04-01 13:36:42 +01:00
Christian Wesselhoeft
89a1639952 Fix jshint issues in src/tilemap 2014-03-25 14:56:04 -07:00
Christian Wesselhoeft
61f18b675c Trim trailing whitespace. 2014-03-25 14:56:04 -07:00
photonstorm
26a89f0b84 New build files with tilemap callback fixes in. 2014-03-24 01:39:09 +00:00
photonstorm
49bcd2edd2 Tilemap fixes. 2014-03-24 00:30:05 +00:00
photonstorm
e1c98ba617 You can now create multiple blank layers in a Tilemap. 2014-03-23 23:58:01 +00:00
photonstorm
0fa54b0b24 TileSprites now emit outOfBounds and enterBounds events accordingly.
TileSprites working with physics bodies again.
2014-03-21 18:04:24 +00:00
photonstorm
46d5069110 Tilemap.createFromObjects has a new parameter: adjustY, which is true by default. Because Tiled uses a bottom-left coordinate system Phaser used to set the Sprite anchor to 0,1 to compensate. If adjustY is true it now reduces the y value by the object height instead. 2014-03-17 23:54:04 +00:00
photonstorm
90ef694347 Tilemap.createFromObjects used to set the Sprite anchor to 0,1 because Tiled uses a bottom-left coordinate system. It now calculates the offset in TilemapParser. 2014-03-17 23:27:13 +00:00
photonstorm
30a04985f7 Working through blank tilemap fix. 2014-03-17 16:10:19 +00:00
photonstorm
b9ac0d565e Fixed Tile callback check in Arcade Physics (fix #562) 2014-03-16 00:53:50 +00:00
photonstorm
0e29bd4300 Tile Collision Callbacks working properly. CSV / Blank map examples added. Multiple tilesets per map working again. That's it folks! 2014-03-14 04:21:56 +00:00
photonstorm
f3ff9c197f Fixed all the tilemap examples. 2014-03-14 03:26:06 +00:00
photonstorm
e955145707 Added p2 kill and reset test + nearing completion on tilemap collision. 2014-03-13 21:14:18 +00:00
photonstorm
c8e63582a4 Lots of small tweaks to pass jshint. 2014-03-13 16:49:52 +00:00
Dan Cox
3b7039ad32 Documentation change: swap for swapTile
In both Phaser 1.1.6 and 1.2, it says "swapTile" when it means "swap".
2014-03-11 23:56:12 -04:00
Dan Cox
5fcc8db8a4 Tilemap.swap() called twice should not flip values
Repeat calls to swap() should not affect index values a second time.
"swap(1,2); swap(1,2)" should not be the same as "swap(2,1)."

(This also affects Phaser 1.1.6.)
2014-03-11 23:41:37 -04:00
photonstorm
58887d9bc6 Moved all of the Tilemap to P2 body methods into P2 itself (makes more sense this way) and tidied them up. 2014-03-11 15:02:59 +00:00
photonstorm
1c68ff9042 Tilemap.createFromObjects allows you to specify you own object type to be created if you want a class that extends Phaser.Sprite. 2014-03-07 03:19:07 +00:00
photonstorm
5a6ae5f696 Tilemap.putTile now correctly re-calculates the collision data based on the new collideIndexes array (fixes #371)
Tilemap.putTile can now insert a tile into a null/blank area of the map (before it could only replace existing tiles)
2014-03-04 03:08:35 +00:00