Gerben Posted July 25, 2014 Share Posted July 25, 2014 I'm making a platformer and for certain indices I want to be able to jump up, i.e. no collision from the bottom.I have seen this work for sprite on sprite collision, but not sprite on tilemap collision. How can you set collision data on specific tiles in a tilemap? Link to comment Share on other sites More sharing options...
lewster32 Posted July 25, 2014 Share Posted July 25, 2014 http://docs.phaser.io/Phaser.Tile.html#collideDown Link to comment Share on other sites More sharing options...
Gerben Posted July 27, 2014 Author Share Posted July 27, 2014 I've tried to get a specific tile so I could apply that method, but nothing seems to work.map.setCollision([1,2,3]);var water = map.searchTileIndex(2);water.collideDown();Line 2 will give me an 'undefined is not a function'. My thought process was the Tilemap (var map) contains all the tile data, so I could ask that object to give me the Tile object of index 2 (var water). Link to comment Share on other sites More sharing options...
Dumtard Posted July 27, 2014 Share Posted July 27, 2014 Tile.collideDown is not a function, just as the error says. It is a boolean value.water.collideDown = falsewater.collideUp = truewater.collideLeft = truewater.collideRight = trueThat will allow people to pass through from the bottom but not in any other direction. Link to comment Share on other sites More sharing options...
Gerben Posted July 27, 2014 Author Share Posted July 27, 2014 I see. I'm getting the error on the searchTileIndex() function. Is that the way to get a tile type? It was the function that looked the most promising. There's also getTile() but that returns just a number and requires x,y coords. Edit: Oh wow.. Apparently I was still running 2.0.4 instead of 2.0.7. It works now. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts