From f58e38dc3f41e3eb3e2962269eb220e1a21494cc Mon Sep 17 00:00:00 2001 From: ShadowMario <44785097+ShadowMario@users.noreply.github.com> Date: Sun, 29 Sep 2024 14:24:39 -0300 Subject: [PATCH] Added 8 new camera functions to lua --- source/psychlua/FunkinLua.hx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/psychlua/FunkinLua.hx b/source/psychlua/FunkinLua.hx index f0cacfd6b06..1ad7043817e 100644 --- a/source/psychlua/FunkinLua.hx +++ b/source/psychlua/FunkinLua.hx @@ -825,6 +825,19 @@ class FunkinLua { game.moveCamera(isDad); return isDad; }); + + Lua_helper.add_callback(lua, "setCameraScroll", function(x:Float, y:Float) FlxG.camera.scroll.set(x - FlxG.width/2, y - FlxG.height/2)); + Lua_helper.add_callback(lua, "setCameraFollowPoint", function(x:Float, y:Float) game.camFollow.setPosition(x, y)); + Lua_helper.add_callback(lua, "addCameraScroll", function(?x:Float = 0, ?y:Float = 0) FlxG.camera.scroll.add(x, y)); + Lua_helper.add_callback(lua, "addCameraFollowPoint", function(?x:Float = 0, ?y:Float = 0) { + game.camFollow.x += x; + game.camFollow.y += y; + }); + Lua_helper.add_callback(lua, "getCameraScrollX", () -> FlxG.camera.scroll.x + FlxG.width/2); + Lua_helper.add_callback(lua, "getCameraScrollY", () -> FlxG.camera.scroll.y + FlxG.height/2); + Lua_helper.add_callback(lua, "getCameraFollowX", () -> game.camFollow.x); + Lua_helper.add_callback(lua, "getCameraFollowY", () -> game.camFollow.y); + Lua_helper.add_callback(lua, "cameraShake", function(camera:String, intensity:Float, duration:Float) { LuaUtils.cameraFromString(camera).shake(intensity, duration); });