How do I make a lever?

  • Hello.

    First of all excuse me for most of my questions but I'm a total beginner.

    I'm trying to make a lever to open doors but I'm running into some issues trying to figure out how to pull off the animtion because I was thinkin about On animation finished and On Key pressed, and can't use both for the same event.

    I want the following: When player overlaps lever and presses action key, activates lever.

    Basically I have two animations. The default and the Go or Swap animation. The default is on one position, whenever player presses "Action Key" set animation to Swap and the lever goes to the other position.

    Now, if I press "Action Key" again, it feels like you switch the lever twice because if goes to the original spot and does the animation again. I want to be able to go back and fourth so when I press Action Key again the animation plays backwards.

    Any tips? I was thinking just to create two animations but feels like I run ito the same problems with the triggering since I need both Key Pressed and On Finished. Right?

  • Im trying an even easier thing using just 2 frames. Still can't get it to work. Is this really wrong?

  • You need an Else in event 30 to stop both actions running.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need an Else in event 30 to stop both actions running.

    God bless you.

  • So I also managed to make each Lever to work individually but now comes the tricky part.

    I want that each lever works with one specific gate. I'm guessing I have to use some variables to make this work but I have no idea which path I need to take.

    This is what I have so far:

    Now each lever works individually but I need to attach each lever to a gate.

  • OMG I DID IT. I can't believe it. Never felt so proud. Guess I'm starting to be less retarded.

  • I just helped someone do this:

    You need to associate the gate UID with the lever and pick the gate, not the lever.

  • I did it with a variable on Lever called Which_Gate.

    Pick UID - Lever.UID

    Pick UID - Lever.Which_Gate

    Works like a charm.

  • Or you can go with variables like this. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    https://www.dropbox.com/s/hgmygmup9nivm ... .capx?dl=0

  • I did it with a variable on Lever called Which_Gate.

    Pick UID - Lever.UID

    >Pick UID - Lever.Which_Gate

    Works like a charm.

    I thought UIDs changed every time the game was loaded.

  • > I did it with a variable on Lever called Which_Gate.

    >

    > Pick UID - Lever.UID

    > >Pick UID - Lever.Which_Gate

    >

    > Works like a charm.

    >

    I thought UIDs changed every time the game was loaded.

    Hmm no, that's why they're unique. As far as I know.

  • Tekniko: UIDs for the instances already existing in the layout on edit time will be the same.

    Perhaps you are mixing up with IIDs which can be reused when you spawn/delete/spawn instances inside a specific object type and which are considered far more "volatile" ?

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