Page 1 of 1

Moving layers with keyboard

Posted: 9 Feb 2018, 5:35
by hacheipe399
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.

Posted: 9 Feb 2018, 6:32
by Ariinui
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:

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

Posted: 16 Feb 2018, 17:52
by hacheipe399
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.