Moving layers with keyboard

Description: Official subforum for LunaLua - an extension framework for SMBX Engine Version 1.3 (which a core of SMBX 2.0). Share your creations that require the use of LunaLUA. You may also share info/tutorials on how to use LunaLUA.
Moderator: Moderators

hacheipe399
Topic author, Honourable citizen
Honourable citizen
hacheipe399
Topic author, Honourable citizen
Honourable citizen
Reputation: 13
Posts: 41
Joined: 24 Feb 2014

Post #1by hacheipe399 » 9 Feb 2018, 5:35

I have in mind a lift which moves down automatically when the player stands above it and strikes the down key once. Also when the player presses the up key once, the lift goes up, both movements can move on a indefinite time.
Any suggestion where to start? I had no luck with it.

Ariinui
Duke
Duke
Ariinui
Duke
Duke
Age: 23
Reputation: 10
Posts: 110
Joined: 5 Mar 2017

Post #2by Ariinui » 9 Feb 2018, 6:32

where to start? start by learning VB (visual basic) , it'll help you vith teascript
then don't hesitate to look at some scripts while reading the scripting manual the scripts example levels are there for that ^^

here some ideas:
for the first if (the base's condition)
use the player's y position to compare with the lift's y position (if the player's right above the npc)
ehen, do the same for the player's x position, (it the player's podition is between lift's x position + 32 and he lift's position - 32 (this would be a verry sall lift though) )

then, make the lift move if the up/down button's pressed

it's really poorly explained but i think it's doable

Added after 15 hours 3 minutes:
wihile reading the question one more time, i've got an other idea:
look with the collision script aera in the liquid/gravity section
first do a collision aera on top of the lift that will toggle on the script
then do others collision aera around the first one that will toggle off the script

the script will look at the key pressed and move the layer depending of which key is pressed (up will make the layer going up etc.)

Added after 26 minutes 49 seconds:
here's a pic to illustrate my second idea:
Image

the red collision aera would toggle off the script and the blue would tuggle on the event


this solution could be problematic if you play in 2 player mode

hacheipe399
Topic author, Honourable citizen
Honourable citizen
hacheipe399
Topic author, Honourable citizen
Honourable citizen
Reputation: 13
Posts: 41
Joined: 24 Feb 2014

Post #3by hacheipe399 » 16 Feb 2018, 17:52

Nice idea. Don't worry about the amount of players, the level that I'm making is restricted to 1 player.
Then I'll see how to implement it.
Thank you.


Return to “LunaLua - Extension Framework”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest