simpleLayerMovement.lua - For all your custom layer movement needs!

Share and discuss custom LunaLua code and content packs for SMBX2.
MrDoubleA
Flurry
Flurry
Posts: 351
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?
Pronouns: he/him

simpleLayerMovement.lua - For all your custom layer movement needs!

Postby MrDoubleA » Wed Apr 01, 2020 3:11 pm

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".
Screenshot: show
Image
Loading & Examples: show
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)}}

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9491
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: simpleLayerMovement.lua - For all your custom layer movement needs!

Postby Enjl » Wed Apr 01, 2020 3:59 pm

This is really cool. Well done!

PROX
Banned
Posts: 1953
Joined: Sun Jul 06, 2014 8:50 pm

Re: simpleLayerMovement.lua - For all your custom layer movement needs!

Postby PROX » Mon Apr 06, 2020 6:52 am

Finally we won't have crazy jank moving layers. This will be very useful.

Nathan7934
Goomba
Goomba
Posts: 2
Joined: Tue Sep 20, 2022 11:46 pm
Pronouns: he/him

Re: simpleLayerMovement.lua - For all your custom layer movement needs!

Postby Nathan7934 » Sat Sep 24, 2022 1:47 am

Just wanted to say that I found this library very helpful. Thanks for making it!

Iggizorn
Shy Guy
Shy Guy
Posts: 8
Joined: Mon May 16, 2022 2:55 am
Pronouns: he/him

Re: simpleLayerMovement.lua - For all your custom layer movement needs!

Postby Iggizorn » 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

MrDoubleA
Flurry
Flurry
Posts: 351
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?
Pronouns: he/him

Re: simpleLayerMovement.lua - For all your custom layer movement needs!

Postby MrDoubleA » Mon Jan 02, 2023 5:55 pm

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).

Iggizorn
Shy Guy
Shy Guy
Posts: 8
Joined: Mon May 16, 2022 2:55 am
Pronouns: he/him

Re: simpleLayerMovement.lua - For all your custom layer movement needs!

Postby Iggizorn » 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?! :/

MrDoubleA
Flurry
Flurry
Posts: 351
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?
Pronouns: he/him

Re: simpleLayerMovement.lua - For all your custom layer movement needs!

Postby MrDoubleA » Tue Jan 03, 2023 10:35 am

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.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest