-
Notifications
You must be signed in to change notification settings - Fork 485
Closed
Milestone
Description
Originally reported here.
Code to reproduce:
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.graphics.FlxGraphic;
import flixel.tile.FlxTilemap;
import flixel.util.FlxColor;
class PlayState extends FlxState
{
public var sprite:FlxSprite;
public var tiles:FlxTilemap;
override public function create():Void
{
super.create();
sprite = new FlxSprite(0, 8);
sprite.makeGraphic(8, 8);
add(sprite);
tiles = new FlxTilemap();
tiles.loadMapFrom2DArray([[1],[0]], FlxGraphic.fromClass(GraphicAuto));
tiles.x += 20;
add(sprite);
add(tiles);
}
override public function update(_):Void
{
super.update(_);
readInput();
FlxG.collide(sprite, tiles);
}
public function readInput()
{
var speed = 50;
sprite.velocity.y =
if (FlxG.keys.anyPressed([UP, W])) -speed;
else if (FlxG.keys.anyPressed([DOWN, S])) speed;
else 0;
sprite.velocity.x =
if (FlxG.keys.anyPressed([LEFT, A])) -speed;
else if (FlxG.keys.anyPressed([RIGHT, D])) speed;
else 0;
}
}Moving from left to right works fine - right to left doesn't though, the sprite gets stuck at the edeg of the tilemap. Doesn't seem to be a target-specific issue.
Supposedly, this doesn't happen in AS3 Flixel (haven't tested myself), so comparing some of the collision code might be helpful.
Originally reported here.
Happens in both dev and 3.3.8, so not a recent regression.
Metadata
Metadata
Assignees
Labels
No labels