Skip to content

Commit eff58af

Browse files
committed
use object.getDefaultCamera instead of FlxG.camera
1 parent 0b97a43 commit eff58af

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

source/funkin/backend/utils/CoolUtil.hx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -987,15 +987,13 @@ final class CoolUtil
987987
* Returns the screen position of an object, while taking the camera zoom into account.
988988
*
989989
* @param object Any `FlxObject`
990-
* @param camera The desired "screen" coordinate space. If `null`, `FlxG.camera` is used.
990+
* @param camera The desired "screen" coordinate space. If `null`, a default camera is used.
991991
* @param result Optional arg for the returning point
992992
* @return The screen position of the object.
993993
*/
994994
public static function worldToScreenPosition(object:FlxObject, ?camera:FlxCamera, ?result:FlxPoint) {
995-
if (result == null)
996-
result = FlxPoint.get();
997-
if (camera == null)
998-
camera = FlxG.camera;
995+
if (result == null) result = FlxPoint.get();
996+
if (camera == null) camera = object.getDefaultCamera();
999997

1000998
result.set(object.x, object.y);
1001999
result.x = (((result.x - camera.scroll.x * object.scrollFactor.x) * camera.zoom) - ((camera.width * 0.5) * (camera.zoom - camera.initialZoom)));

0 commit comments

Comments
 (0)