so I have been using flixel I some recently, and I think I am getting a feel for it, but I have come across a issue.
I have a Map class, that uses the loadMap()
function, which comes out great.
I then use setTileProperties()
on my Water tile, that then calls a function, calls a Boolean on my player class (to say that he is in the water), which then slows him down. This still works great, except for one thing. When I pass the water tile above or to the right (about 10-16ish pixels, haven't gotten the exact number) outside the tile, it still slows the player. I am not sure if this is just the way that FlxG.collide()
works, or if there is something I can do to fix it, or maybe if I should find another way to use the collision. All help is appreciated.
Here is the code, if you need it:
Map.as
private function createMap():void {
loadMap(new currentMap, currentTiles, 32, 32, 0, 0, 0);
setTileProperties(4, FlxObject.NONE, PlayerInWater);
}
override public function update():void {
super.update();
FlxG.collide(Registry.player, this);
}
private function PlayerInWater(tile:FlxTile, player:Player):void {
Registry.player.inWater = true;
trace("player is in the water");
}