Elevator system help (Going to the floor you want)

Get help using Construct 2

Post » Sat Mar 17, 2012 2:31 pm


How would I go about making an elevator system for a platform game?
Not just a simple back and forth movement but something that stops at desired floors through pressing the corresponding button.

I tried messing around with custom movement but ended up using the sine behavior on the elevator in a way that it only moves when the player is standing on it.
SineElevatorExample

Far from perfect I know. And the player jumps/lags quite a bit. Attempted to fix the lag by looking at the example Yann posted here: Vertical Moving Platform

...but instead the entire elevator lagged immensly.



Here is a similar test layout where I wanted to use the buttons to make the elevator move to the desired floor, but I don't know where to start!
Global variables, instance variables? Loops?ButtonsMovingElevator



The layouts are all just mockups to test if things work.
And don't mind the silly testdummy in the first capx!

I do not expect a cake on a silver plate but any little help to show me the way is greatly appreciated. Sorry if I missed a topic already explaining something similar.
If you take a look at this, thank you in advance!Hybrid2012-03-18 13:56:25
B
2
Posts: 3
Reputation: 256

Post » Sun Mar 18, 2012 3:06 pm

For the lagging elevator, try disabling event 21 in Yann's example, and you'll hopefully see what it does.

Controlling the elevator with buttons gets a bit more complicated though, I don't think sine movement is the best behaviour to use in that case.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sun Mar 18, 2012 3:51 pm

you could try to use Custom movement instead of sine

I would try this

On key x pressed:

if player overlapping elevator object:

elevator move towards position (elevator.x, arrival platform.y)

And i think you need to stop it when both Y values are the same...

I'm not sure if this works and cant test it since i don't have construct here right now

But with no testing its what i would try out first
B
28
S
2
Posts: 69
Reputation: 1,491

Post » Sun Mar 18, 2012 5:39 pm

I modified your .capx a bit, hope it helps:

Example: Elevator, 3 floors (No buttons)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sun Mar 18, 2012 5:42 pm

@Nimtrix    Cool, I'll try disabling it! And I know sine movement isn't the right approach, was just a test and also to get any result at all :)
thanks for replying!

@rgros     I updated the second example. I tried custom movement that is only enabled when player is overlapping the elevator + pressing blankspace for it to start moving. At both ends are colliderobjects that reverse the custom movement on collision.

I did that before reading your post actually. What I can't get to work atm, is to press blankspace again to make the elevator stop. And also to tell it to wait x seconds at either the endfloors or each floor, but each floor would get too boring in gameplay.

This is an acceptable method to use if I am to skip the complex system with buttons completely :)


EDIT: AH! Didn't see your second post there, I'll check the capx!
Thank you so far Nimtrix!Hybrid2012-03-18 17:43:51
B
2
Posts: 3
Reputation: 256

Post » Mon Mar 19, 2012 6:45 pm

Sorry for this double post!

I got so carried away with the modified capx that I forgot to say thank you!
Best thing is I understand it all! :) Compare Y, of course!

Thank you Nimtrix!!
B
2
Posts: 3
Reputation: 256


Return to How do I....?

Who is online

Users browsing this forum: armaldio, blackhornet, TiagoCesar and 18 guests