Page 1 of 1
simpleLayerMovement.lua - For all your custom layer movement needs!
Posted: Wed Apr 01, 2020 3:11 pm
by MrDoubleA
This is a library which allows for you to simply create complex layer movement. You can
download it here! For examples and how to use, see "Loading & Examples".
To load it, simply put this in your luna.lua file:
Code: Select all
local slm = require("simpleLayerMovement")
Here are some examples:
Circular Movement
Code: Select all
slm.addLayer{name = "move 1",movement = slm.MOVEMENT_CIRCLE,speed = 64,verticalDistance = 1,horizontalDistance = 1.5}
slm.addLayer{name = "move 2",movement = slm.MOVEMENT_CIRCLE,speed = 32,distance = 0.5}
Looping Movement
Code: Select all
slm.addLayer{name = "move 1",verticalMovement = slm.MOVEMENT_LOOP,verticalSpeed = 2,verticalDistance = 320}
Cosine Wave Movement
Code: Select all
slm.addLayer{name = "move 1",speed = 96,horizontalMovement = slm.MOVEMENT_COSINE,horizontalSpeed = 64,horizontalDistance = 1}
Points Movements
Code: Select all
slm.addLayer{name = "move 1",movement = slm.MOVEMENT_POINTS,speed = 1,points = {vector(64,32),vector(96,96),vector(-96,96),vector(-64,32),vector(0,0)}}
slm.addLayer{name = "move 2",movement = slm.MOVEMENT_POINTS,speed = 3,points = {vector(48,-48),vector(96,0),vector(0,0)}}
Re: simpleLayerMovement.lua - For all your custom layer movement needs!
Posted: Wed Apr 01, 2020 3:59 pm
by Enjl
This is really cool. Well done!
Re: simpleLayerMovement.lua - For all your custom layer movement needs!
Posted: Mon Apr 06, 2020 6:52 am
by PROX
Finally we won't have crazy jank moving layers. This will be very useful.
Re: simpleLayerMovement.lua - For all your custom layer movement needs!
Posted: Sat Sep 24, 2022 1:47 am
by Nathan7934
Just wanted to say that I found this library very helpful. Thanks for making it!
Re: simpleLayerMovement.lua - For all your custom layer movement needs!
Posted: Mon Jan 02, 2023 5:06 pm
by Iggizorn
I don't understand how to use the script =(. I wrote local slm = require("simpleLayerMovement") in my lua file from the level. Packed the lua file from the script in my level folder. I don't understand where and how I should now register my layer from the editor. Can someone explain that to me in a bit more detail
Re: simpleLayerMovement.lua - For all your custom layer movement needs!
Posted: Mon Jan 02, 2023 5:55 pm
by MrDoubleA
Iggizorn wrote: ↑Mon Jan 02, 2023 5:06 pm
I don't understand how to use the script =(. I wrote local slm = require("simpleLayerMovement") in my lua file from the level. Packed the lua file from the script in my level folder. I don't understand where and how I should now register my layer from the editor. Can someone explain that to me in a bit more detail
You cannot use it from the editor itself. You need to add some extra code to your luna.lua file (like what's shown in the "examples" part of the post).
Re: simpleLayerMovement.lua - For all your custom layer movement needs!
Posted: Mon Jan 02, 2023 7:21 pm
by Iggizorn
I know how to address layers from the lua file. I have read the code several times and do not understand where to place my layer. Is it possible to upload a small demo level where i can see how it works? maybe?! :/
Re: simpleLayerMovement.lua - For all your custom layer movement needs!
Posted: Tue Jan 03, 2023 10:35 am
by MrDoubleA
Iggizorn wrote: ↑Mon Jan 02, 2023 7:21 pm
I know how to address layers from the lua file. I have read the code several times and do not understand where to place my layer. Is it possible to upload a small demo level where i can see how it works? maybe?! :/
All you need to do to get started is copy and paste the examples into your luna.lua file, and change the names. If you are having trouble, you can send your current code to let me see what's wrong with it.