[SOLVED] Move object when key clicked

0 favourites
  • 7 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • 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 :


    here is my capx, help please i'm sure i'm doing it wrong , thanks

  • Any ideas ^^

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

  • rekjl i understand the idea but i didn't succeed ^^'

    here is the capx with variables :

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • that's exactly what i want to do, thank you LittleStain

    but i don't understand the difference between toggle boolean and set boolean ?

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

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