How do I make a lever?

Get help using Construct 2

Post » Sat Sep 03, 2016 11:59 am

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?
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Sat Sep 03, 2016 12:31 pm

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

Image
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Sat Sep 03, 2016 1:24 pm

You need an Else in event 30 to stop both actions running.
ImageImageImage
B
71
S
21
G
229
Posts: 3,687
Reputation: 128,338

Post » Sat Sep 03, 2016 1:46 pm

blackhornet wrote:You need an Else in event 30 to stop both actions running.


God bless you.
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Sat Sep 03, 2016 2:26 pm

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:

Image

Now each lever works individually but I need to attach each lever to a gate.
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Sat Sep 03, 2016 2:48 pm

OMG I DID IT. I can't believe it. Never felt so proud. Guess I'm starting to be less retarded.
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Sat Sep 03, 2016 2:50 pm

I just helped someone do this:
how-do-i-simplify-this-instance-var_t181210

You need to associate the gate UID with the lever and pick the gate, not the lever.
ImageImageImage
B
71
S
21
G
229
Posts: 3,687
Reputation: 128,338

Post » Sat Sep 03, 2016 4:26 pm

I did it with a variable on Lever called Which_Gate.

Pick UID - Lever.UID
>Pick UID - Lever.Which_Gate

Works like a charm.
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Sat Sep 03, 2016 4:51 pm

Or you can go with variables like this. :mrgreen:

https://www.dropbox.com/s/hgmygmup9nivm ... .capx?dl=0
B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Sun Sep 04, 2016 2:46 am

Smileh wrote: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.
B
56
S
15
G
13
Posts: 826
Reputation: 17,645

Next

Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot] and 17 guests