-
Code snippet reproducing the issue: package;
import flixel.util.FlxColor;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
//press a to swap from an x scale of 1 and -1, red is 1 blue is -1
class PlayState extends FlxState
{
var hi:FlxSprite;
override public function create()
{
hi = new FlxSprite().makeGraphic(100, 100, FlxColor.WHITE);
hi.color = FlxColor.RED;
add(hi);
super.create();
}
override public function update(elapsed:Float)
{
hi.setPosition(FlxG.mouse.x, FlxG.mouse.y);
if(FlxG.keys.justPressed.A) {
hi.scale.x *= -1;
hi.color = (hi.scale.x == -1) ? FlxColor.BLUE : FlxColor.RED;
hi.updateHitbox();
}
super.update(elapsed);
}
}
Observed behavior: the sprite stops rendering at the edge of the camera when it should be visible Expected behavior: the sprite stops rendering when it leaves the cameras area 2023-06-11.23-26-05.mp4 |
Beta Was this translation helpful? Give feedback.
Answered by
Geokureli
Jun 12, 2023
Replies: 1 comment
-
Scale should not be negative, if you want to invert a sprite, use the flipX and flipY fields Ill see if this can be handled better, but negative scale may cause other issues elsewhere, and should really be avoided |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Geokureli
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scale should not be negative, if you want to invert a sprite, use the flipX and flipY fields
Ill see if this can be handled better, but negative scale may cause other issues elsewhere, and should really be avoided