diff --git a/docs/modchart.md b/docs/modchart.md index 4e5b08a..f6f9947 100644 --- a/docs/modchart.md +++ b/docs/modchart.md @@ -116,6 +116,7 @@ Current calls to functions include, | update | Elapsed frames | Gets called every frame (after the song starts) | | stepHit | Current Step | Gets called when ever a step hits (steps are in between beats, aka 4 steps are in a beat) | | beatHit | Current Beat | Gets called when ever a beat hits | +| keyPressed | Key Pressed | Gets called when a key just got pressed (up, down, left, right, accept) | diff --git a/source/PlayState.hx b/source/PlayState.hx index 3e3040d..d1a301e 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2832,6 +2832,13 @@ class PlayState extends MusicBeatState controls.UP_R, controls.RIGHT_R ]; + if (luaModchart != null){ + if (controls.LEFT_P){luaModchart.executeState('keyPressed',["left"]);}; + 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_P){luaModchart.executeState('keyPressed',["accept"]);}; + }; // Prevent player input if botplay is on if(FlxG.save.data.botplay)