This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
forked from FunkinCrew/Funkin
-
Notifications
You must be signed in to change notification settings - Fork 57
Lua API
Leather128 edited this page Feb 2, 2023
·
4 revisions
Warning! This documentation is VERY unfinished, you will probably have to look in the source code of Leather Engine to find everything you can do for the moment.
Name | Description |
---|---|
Int | Any whole number. |
Float | Any number. |
Bool |
true or false . |
String | Text |
Void | No return value. |
- os (allows access to the operating system, which can also be dangerous)
- require (allows other libraries which can be dangerous to be accessed)
function start(song)
set('scoreTxt.alpha', 0.5)
end
Sets score text to half transparent
function start(song)
tween('boyfriend', { x = get('boyfriend.x') + 300 }, 1, 'cubeInOut', 3, function()
tween('boyfriend', { x = get('boyfriend.x') - 300 }, 1, 'cubeInOut')
end)
end
Smoothly moves boyfriend 300 pixels to the right after waiting 3 seconds, and then back to left 300 pixels.
function start(song)
newText('yourMom', 'i am a little goofy', 0, 0, 16)
set('yourMom.borderColor', color(0, 0, 0))
set('yourMom.borderStyle', "OUTLINE")
setObjectCamera('yourMom', 'hud')
add('yourMom')
tween("yourMom", { x = 640, y = 360 }, 2, "linear", 0, function()
tween("yourMom", { x = 0, y = FlxG.height - 18 }, 2, "linear")
end)
loadScript("test-script")
print(exists('yourMom'))
end
Creates and moves a text label across the screen with tweens (also loads another script named 'test-script' and prints whether or not the
yourMom
sprite exists)
-- when the stage lua is created
function create(stage)
print(stage .. ' is our stage!')
-- make our sprites B)
makeStageSprite('stageback', 'stageback', -600, -200, 1)
setActorScroll(0.9, 0.9, 'stageback')
makeStageSprite('stagefront', 'stagefront', -650, 600, 1.1)
setActorScroll(0.9, 0.9, 'stagefront')
makeStageSprite('stagecurtains', 'stagecurtains', -500, -300, 0.9)
setActorScroll(1.3, 1.3, 'stagecurtains')
-- set extra properties like camera zoom (can be done in json still but frick you)
set('stage.camZoom', 0.9)
end
-- same as start function in a regular modchart
function start(stage)
end
-- called each frame with elapsed being the seconds between the last frame
function update(elapsed)
end
-- everytime a beat hit is called on the song this happens
function beatHit(curBeat)
end
-- any other functions from regular modcharts can also be put here :DDD
Template Stage Lua
Variable | Description | Type |
---|---|---|
difficulty | The current difficulty. | String |
difficulty (Legacy pre 0.4.1) | The current difficulty from 0 to 2 | Int |
bpm / songBpm | Current BPM (Beats per minute) | Float |
keyCount | Opponent's key count currently (equal to playerKeyCount unless specifically specified). |
Int |
playerKeyCount | Player's key count currently. | Int |
scrollspeed | The current scroll speed. | Float |
curBeat | The current 'beat' (4th note) of the song. | Int |
curStep | The current 'step' (16th note) of the song. | Int |
crochet | Time between each 'step' (16th note) of the song in milliseconds. | Float |
bot | Botplay setting value. | Bool |
noDeath | No Death setting value. | Bool |
downscrollBool | Downscroll setting value. | Bool |
downscroll (Deprecated |
Downscroll setting value (0 or 1). | Int |
middlescroll | Middlescroll setting value. | Bool |
flashingLights / flashing | Flashing Lights setting value. | Bool |
distractions (Not Implemented ❌ ) | Distractions setting value (always true ). |
Bool |
animatedBackgrounds | Animated Backgrounds setting value. | Bool |
fpsCap | FPS Cap setting value. | Int |
cameraZooms | Camera Zooms setting value. | Bool |
-
FlxColor
- Has each static property from the haxeflixel class itself as a property you can access (no functions).
-
FlxG
- Has 3 properties, width, height, and elapsed, these are all equal to the respective values in flixel.FlxG
-
Conductor
- Has all static properties from game.Conductor.
-
lua
- Has 2 properties, "version", and "versionJIT", these are string versions of the current Lua version and LuaJIT version respectively.
-
SONG
- Equivalent to states.PlayState.SONG.
Function | Description | Parameters | Return |
---|---|---|---|
loadScript | Loads the script from path into the game. |
path:String | Void |
tween | Tweens object using properties with a duration of duration , after startDelay , with the ease of ease (see FlxEase Docs for names to use), and calls onComplete at the end of the tween. |
object:String, properties:Table, duration:Float, ease:String (name of FlxEase to use), ?startDelay:Float = 0.0, ?onComplete:Function<Void -> Void> | Void |