Elgan Posted June 3, 2014 Share Posted June 3, 2014 if (this.game.physics.arcade.collide(this, this.game.level.blockedLayer, null, this.checkHitsHardblock)) { blocked = true; //checked, NEVER CALLS } checkHitsHardblock(ob1: any, obj2: any) { return false; } The character still hits into hard blocks? but when i delete the above collide check. he does not. (no checks)So he is still colliding, even though collide is always returning false. Link to comment Share on other sites More sharing options...
TomFiveThumbs Posted June 3, 2014 Share Posted June 3, 2014 You can set callbacks for when the player hits a specific type of tile, for example...// Make the layerrockLayer=map.createLayer('Rocks');// Set collision for only these tile indexesmap.setCollision([0,3,6,7,8,9,10],true,'Rocks');// Set a custom callback for tile of index 3 map.setTileIndexCallback(3, hitDifferentBlock, player, 'Rocks');Then in custom function hitDifferentBlock, you do your custom hit action, then return false or true to the general hit check. Link to comment Share on other sites More sharing options...
Elgan Posted June 4, 2014 Author Share Posted June 4, 2014 thank you, i am looking into it. However, I really dont get the whole setCollision and setTileIndexCallback.I have maybe 1200 tiles. How am i supposed to know all of the tile indexes!i'm going to try looping through a blocked layer and adding callbacks to each tile returned. I assume it will return it's index too. there should be a setCollisionAll() and a setCallBackAll()That way you can build a map from layers, and all the tiles on layer "rocks" act in that way etc. However collide still is not working how its supposed to; Im wondering if this is related to this bug?http://www.html5gamedevs.com/topic/6864-sprite-vs-tilemaplayer-separates-even-when-processcallback-returns-false-even-when-using-overlap-instead-of-collide/ Link to comment Share on other sites More sharing options...
TomFiveThumbs Posted June 4, 2014 Share Posted June 4, 2014 You have 1200 types of tiles or 1200 total tiles?setTileIndexCallback applies the callback to every tile that uses the same indexed tile graphic. So if you have a tile that is, a mario question mark block, and you apply the setTileIndexCallback to that index from the tileset, every tile that uses that graphic with fire the callback upon collision/overlap.Without seeing it in action I can only guess at what the issue is. Link to comment Share on other sites More sharing options...
Elgan Posted June 5, 2014 Author Share Posted June 5, 2014 1200 tiles in total; ok that works, thank you. I can work with that the issue with collide , i cant find, i think it's related to the submitted bug. Link to comment Share on other sites More sharing options...
Recommended Posts