fixed upside down tankmens

Co-Authored-By: Ne_Eo <NeeEoo@users.noreply.github.com>
This commit is contained in:
Dirk-Dinkum
2024-04-13 20:55:26 +02:00
co-authored by Ne_Eo
parent d145c6f683
commit 3daeb97362
2 changed files with 19 additions and 10 deletions
+17 -8
View File
@@ -211,10 +211,9 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
r.x -= camera.width / 2; r.x -= camera.width / 2;
r.y -= camera.height / 2; r.y -= camera.height / 2;
var ratio = FlxMath.lerp(1 / camera.zoom, 1, zoomFactor); var ratio = (camera.zoom > 0 ? Math.max : Math.min)(0, FlxMath.lerp(1 / camera.zoom, 1, zoomFactor));
r.x *= ratio; r.x *= ratio;
r.y *= ratio; r.y *= ratio;
r.width *= ratio; r.width *= ratio;
r.height *= ratio; r.height *= ratio;
@@ -224,24 +223,34 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
return r; return r;
} }
override public function isOnScreen(?camera:FlxCamera):Bool
{
if (forceIsOnScreen)
return true;
if (camera == null)
camera = FlxG.camera;
var bounds = getScreenBounds(_rect, camera);
if (bounds.width == 0 && bounds.height == 0)
return false;
return camera.containsRect(bounds);
}
// ZOOM FACTOR RENDERING
public override function doAdditionalMatrixStuff(matrix:FlxMatrix, camera:FlxCamera) public override function doAdditionalMatrixStuff(matrix:FlxMatrix, camera:FlxCamera)
{ {
super.doAdditionalMatrixStuff(matrix, camera); super.doAdditionalMatrixStuff(matrix, camera);
if(__shouldDoZoomFactor()) { if(__shouldDoZoomFactor()) {
matrix.translate(-camera.width / 2, -camera.height / 2); matrix.translate(-camera.width / 2, -camera.height / 2);
var requestedZoom = FlxMath.lerp(1, camera.zoom, zoomFactor); var requestedZoom = (camera.zoom >= 0 ? Math.max : Math.min)(FlxMath.lerp(1, camera.zoom, zoomFactor), 0);
var diff = requestedZoom / camera.zoom; var diff = requestedZoom / camera.zoom;
matrix.scale(diff, diff); matrix.scale(diff, diff);
matrix.translate(camera.width / 2, camera.height / 2); matrix.translate(camera.width / 2, camera.height / 2);
} }
} }
public override function getScreenPosition(?point:FlxPoint, ?Camera:FlxCamera):FlxPoint
{
return super.getScreenPosition(point, Camera);
}
// OFFSETTING // OFFSETTING
#if REGION #if REGION
public var animOffsets:Map<String, FlxPoint> = new Map<String, FlxPoint>(); public var animOffsets:Map<String, FlxPoint> = new Map<String, FlxPoint>();
+2 -2
View File
@@ -567,13 +567,13 @@ class StageEditor extends UIState {
} }
}*/ }*/
for(sprite in stage.stageSprites) { for(sprite in stage.stageSprites) {
if(sprite.visible) { if(sprite.visible && sprite.isOnScreen()) {
@:privateAccess if(sprite._frame == null) continue; @:privateAccess if(sprite._frame == null) continue;
drawGuides(sprite); drawGuides(sprite);
} }
} }
for(char in chars) { for(char in chars) {
if(char.visible) { if(char.visible && char.isOnScreen()) {
@:privateAccess if(char._frame == null) continue; @:privateAccess if(char._frame == null) continue;
drawGuides(char); drawGuides(char);
} }