[SOLVED] Move object when key clicked

Get help using Construct 2

Post » Tue Jun 16, 2015 6:49 pm

Hi,

what i want is : move an object from point A to B in Y axes when i click on a key,

the problem i have is if i let the key down the object stop moving, but i want when i click on the key, the object start moving automaticly with one click and stop at the point B, and when i click again the object move back to point A even if he doesn't reach point B

here is an example of what i want to do exactly :
https://vid.me/7pSw

here is my capx, help please i'm sure i'm doing it wrong , thanks
Code: Select all
https://dl.dropboxusercontent.com/u/138507172/construct/moving_object.capx
Last edited by Hunter on Fri Jun 19, 2015 10:34 pm, edited 1 time in total.
B
4
S
1
Posts: 40
Reputation: 532

Post » Wed Jun 17, 2015 7:37 am

Any ideas ^^
B
4
S
1
Posts: 40
Reputation: 532

Post » Wed Jun 17, 2015 11:43 am

I usually do processes like this using variables. For example, when player touches key and variable1 is 0, set variable1 = 1. Than I create a new condition, where if variable1 = 1, do the process of moving your object to its position. Just don't forget to set variable1 back to 0 once your object reaches it's targeted position.
B
42
S
21
G
31
Posts: 685
Reputation: 20,321

Post » Fri Jun 19, 2015 5:55 pm

@Rekjl i understand the idea but i didn't succeed ^^'

here is the capx with variables :

Code: Select all
https://dl.dropboxusercontent.com/u/138507172/construct/moving_object_variable.capx
B
4
S
1
Posts: 40
Reputation: 532

Post » Fri Jun 19, 2015 6:27 pm

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jun 19, 2015 10:17 pm

that's exactly what i want to do, thank you LittleStain :D
but i don't understand the difference between toggle boolean and set boolean ?
B
4
S
1
Posts: 40
Reputation: 532

Post » Sat Jun 20, 2015 7:10 am

Toggle boolean will switch the value. If boolean is true it will become false, if boolean is false it will become true..

set boolean will set the value. If boolean is true and you set value to false, boolean will become false. if boolean is false and you set it to false, boolean will remain false..

Like a light switch, toggle will flip the switch no matter what, turn on the light will only make a difference if the light is off..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: Alvaro2, Hadyurik, imothep85, NN81 and 10 guests