Tilemap Collition Special Tile.



  • Hello, I triying to make a platforms(tiles in this case) like castlevania and metroid, were you can pass down if you press down + Jump. The problem is instead of disabled the collition of the block bellow the player, dissable it in all the tiles that were set with that property making any object with gravity pass it in the moment you press the combination of keys.
    Y extract the code form the example of flxtilemap ext.

    this one:

    function fallInClouds(Tile:FlxObject, Object:FlxObject):Void
    {
    	if (FlxG.keys.anyPressed([DOWN, S]))
    	{
    		Tile.allowCollisions = FlxObject.NONE;
    	}
    	else if (Object.y >= Tile.y)
    	{
    		Tile.allowCollisions = FlxObject.CEILING;
    	}
    }
    

    I try much things, but wiout result inclusive y set the filter for only be called when collide the player.



  • This should work.

    if (Std.is(Tile, TileClassName))
    {
    	var _tile:TileClassName = cast(Tile, TileClassName);
    	_tile.allowCollisions...	
    }


  • Thanks, but this don't work I set the callback in SetTileproperties(), this already filter the collition(for both sides the tiles and the payer), i use a tilemaext for the level, it already filter the class. After try to implement it I think the problem is how the tilemap work and not the function inself, don't allow my work with each tile separately(at least not with this callback). I should manage this colliton in another way.


Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.