Share and discuss custom LunaLua code and content packs for SMBX2.
Moderator: Userbase Moderators
|
|
|
|
-
MrDoubleA
- Flurry

- Posts: 394
- Joined: Mon Aug 20, 2018 7:02 am
- Flair: How much munchers?
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".
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)}}
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9861
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » 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
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

- Posts: 2
- Joined: Tue Sep 20, 2022 11:46 pm
- Pronouns: he/him
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

- Posts: 8
- Joined: Mon May 16, 2022 2:55 am
- Pronouns: he/him
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

- Posts: 394
- Joined: Mon Aug 20, 2018 7:02 am
- Flair: How much munchers?
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

- Posts: 8
- Joined: Mon May 16, 2022 2:55 am
- Pronouns: he/him
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

- Posts: 394
- Joined: Mon Aug 20, 2018 7:02 am
- Flair: How much munchers?
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.
|
|
|
|
|
|
|
|
|
-
Cognition
- Dolphin

- Posts: 83
- Joined: Sun Oct 05, 2014 10:13 pm
Postby Cognition » Sat Apr 22, 2023 1:13 pm
The luna code is trying to find the layers in other levels that don't have these layers, creating an error. How do I isolate the code to just the one level if the examples are to be pasted in the global lua file?
|
|
|
|
|
|
|
|
|
-
MrDoubleA
- Flurry

- Posts: 394
- Joined: Mon Aug 20, 2018 7:02 am
- Flair: How much munchers?
Postby MrDoubleA » Sun Apr 23, 2023 2:01 pm
Cognition wrote: ↑Sat Apr 22, 2023 1:13 pm
The luna code is trying to find the layers in other levels that don't have these layers, creating an error. How do I isolate the code to just the one level if the examples are to be pasted in the global lua file?
Don't put it in the global lua file, and use the level's lua file instead.
|
|
|
|
|
|
|
|
|
-
Just_Thomas
- Spike

- Posts: 296
- Joined: Sat Dec 16, 2023 3:32 am
- Pronouns: he/him
Postby Just_Thomas » Sat Jan 27, 2024 1:17 pm
Really useful. LIke your example screenshot already shows, it is better than npc-106 (SMB1 elevator).
But how exactly did you create this "multiple elevators"-effect (no idea how to call it) without interruption?
(so from SMB 1-2 near the end of the level)
Code: Select all slm.addLayer{name = "move 3",verticalMovement = slm.MOVEMENT_LOOP,verticalSpeed = 2,verticalDistance = 3500}
is only for one of them, if you copy one of these "block-units" with that layer and place if offset than the other "block-unit" will also move only 3500 units.
I could make a lot of copies but at some point all of them have went through and it would take some time, until it does repeat again.
Can you tell me what to do?
|
|
|
|
|
|
|
|
|
-
Alucard648
- Tweeter

- Posts: 170
- Joined: Sun Aug 16, 2015 3:45 am
Postby Alucard648 » Wed Sep 04, 2024 5:08 pm
Is it possible for Poins layer movement to change speed between vectors, so we can have simple crushers like in this gif? Same question goes to looping vectors.

Damn janky vanilla layer movement.
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 3 guests
|