diff --git a/docs/modchart.md b/docs/modchart.md index 40c7b14..3dc8309 100644 --- a/docs/modchart.md +++ b/docs/modchart.md @@ -412,6 +412,18 @@ Returns the width for the sprite id Returns the height for the sprite id +##### changeBoyfriendCharacter(string id) + +Changes the Boyfriend sprite to another character + +##### changeDadCharacter(string id) + +Changes the Dad sprite to another character + +##### playActorAnimation(string/int id, string anim, bool force, bool reverse) + +Plays an animation on a sprite + ### Tweens *Note, On Complete functions are based by the function name (and they also well get called when the tween completes)* @@ -440,14 +452,6 @@ Smoothly fade in to an alpha Smoothly fade out to an alpha -##### changeBoyfriendCharacter(string id) - -Changes the Boyfriend sprite to another character - -##### changeDadCharacter(string id) - -Changes the Dad sprite to another character - diff --git a/source/ModchartState.hx b/source/ModchartState.hx index 7c8df78..28200b3 100644 --- a/source/ModchartState.hx +++ b/source/ModchartState.hx @@ -527,6 +527,10 @@ class ModchartState Lua_helper.add_callback(lua,"setActorX", function(x:Int,id:String) { getActorByName(id).x = x; }); + + Lua_helper.add_callback(lua,"playActorAnimation", function(id:String,anim:String,force:Bool = false,reverse:Bool = false) { + getActorByName(id).playAnim(anim, force, reverse); + }); Lua_helper.add_callback(lua,"setActorAlpha", function(alpha:Float,id:String) { getActorByName(id).alpha = alpha; diff --git a/source/PlayState.hx b/source/PlayState.hx index ecf029c..2a75e5c 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -125,7 +125,7 @@ class PlayState extends MusicBeatState private var curSong:String = ""; private var gfSpeed:Int = 1; - private var health:Float = 1; + public var health:Float = 1; //making public because sethealth doesnt work without it private var combo:Int = 0; public static var misses:Int = 0; private var accuracy:Float = 0.00; @@ -143,7 +143,7 @@ class PlayState extends MusicBeatState private var generatedMusic:Bool = false; private var startingSong:Bool = false; - public var iconP1:HealthIcon; //making these public for modcharts cause i dont know how else to do it + public var iconP1:HealthIcon; //making these public again because i may be stupid public var iconP2:HealthIcon; //what could go wrong? public var camHUD:FlxCamera; private var camGame:FlxCamera; @@ -2831,6 +2831,7 @@ class PlayState extends MusicBeatState if (controls.DOWN_P){luaModchart.executeState('keyPressed',["down"]);}; if (controls.UP_P){luaModchart.executeState('keyPressed',["up"]);}; if (controls.RIGHT_P){luaModchart.executeState('keyPressed',["right"]);}; + if (controls.ACCEPT){luaModchart.executeState('keyPressed',["accept"]);}; }; #end