Elevator system help (Going to the floor you want)

0 favourites
  • 6 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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!

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

  • 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

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

    Example: Elevator, 3 floors (No buttons)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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!

  • 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!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)