elevator and touch

Get help using Construct 2

Post » Thu Jun 27, 2013 1:38 pm

how do i create stering the elevator with a crank by touch like in this pic.
B
107
S
25
G
43
Posts: 1,882
Reputation: 33,501

Post » Thu Jun 27, 2013 2:16 pm

You could make it so that the 'origin point' moves to where the 'touch site' (forgotten the exact event for that) is and then make it so that when it has say "turned 360 degrees" raise it by X amount or rather "for every X degrees move elevator up"
B
20
S
7
G
4
Posts: 322
Reputation: 4,521

Post » Thu Jun 27, 2013 8:53 pm

@Sulli it will work?
B
107
S
25
G
43
Posts: 1,882
Reputation: 33,501

Post » Thu Jun 27, 2013 10:35 pm

@delgado
Your problem was fun to solve :)
I didn't move any origin point, but I use a "handle" point and a origin point. I also had to use the "relative angle" of the sprite, the angle from 0 degree (original angle) and the handle, to synchronise with the touch.
here is the capx
B
17
S
8
G
4
Posts: 461
Reputation: 6,107

Post » Fri Jun 28, 2013 9:54 am

@Guizmus its complete ! how can i change speed of lift, 3-4x slower? because when i turn crank elevator goes too fast
B
107
S
25
G
43
Posts: 1,882
Reputation: 33,501

Post » Fri Jun 28, 2013 9:59 am

@delgado
Download my capx again, I added a textbox to set the "liftSpeed" variable on the go.
I set the speed to 1 when I gave you my capx at first, but you just have to reduce it to 0.5, or 0.2, or whatever fits :) try some values with the textbox, then use the more appropriate one !

Ho, and for anyone who takes a look at it, there are a lot of explications inside the capx, so you should be able to reproduce it/adapt it on lots of other situations.Guizmus2013-06-28 10:00:19
B
17
S
8
G
4
Posts: 461
Reputation: 6,107

Post » Fri Jun 28, 2013 10:15 am

@Guizmus thats great!! your lift goes well

I wonder how modify your lift to:

when i rotate a crank in Events add 1 to variable called 'elevatordown' and when 'elevatordown' variable is greater than 0 elevator automaticaly goes down.
Every move of elevator substract 0.1 from 'elevatordown' variable
Did you have any tips for me at start?
B
107
S
25
G
43
Posts: 1,882
Reputation: 33,501

Post » Fri Jun 28, 2013 10:36 am

@delgado
Well, I moved the elevator directly by using a "move X pixel at the Y angle".
You can replace it by calling a function "ElevatorMove", 2 parameters given (angle and distance) (add a 3rd param with lift.UID if you need).
That function can then move the lift using whatever you want (8 direction behavior? custom movement ? everything is possible).
As the "touch" isn't easy for the user to be precise, you can also just set a moving speed up if cranck is going on one side, speed down else, just to "smooth" things a little.

I'm not sure I answered you, I may have misunderstood what you asked.
B
17
S
8
G
4
Posts: 461
Reputation: 6,107

Post » Fri Jun 28, 2013 4:27 pm

Awesome!
B
20
S
7
G
4
Posts: 322
Reputation: 4,521


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 9 guests