Tilemap Collition Special Tile(Solved).



  • 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.



  • I don't know if you've already fixed the issue but for me I had to add an extra bit of height to my player so the collision would kick in a bit earlier. Liks so

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


  • I try that but in this particular case don't work,the collition of the tile is disabbled while the player is in contact with the tile, that cause the other elements that collide with it fall to(maybe i should try the way around and dissable the player collition instead). Thanks.



  • Hmmm, is there a way to just disable the collision for just the player temporarily and keep it for everything else?

    Also, this has got me curious about the type of game you're making that when the player goes through a tile then other things go through it as well? What other things? Like enemies or NPCs that follow the player?



  • In the end I do something like that, thanks.
    I reemplaze the Tile Allow Collition for a Flag that trigger a state in the Fsm of the object.


Log in to reply
 

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