Can a global variable be changed according to what object is being dragged?

0 favourites
  • 3 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • I am figuring out how to create a very simple drag and drop matching game.

    Currently it's like this: If object 1 is drag & dropped while overlapping the correct item, it will be moved there using tween (move x and y to x and y of correct item). If it is not overlapping, it will return to the initial position. So really simple.

    Now for every additional additional object, I could just copy & paste the . But is there a better way?

    Is it possible to 'automate' the mechanism by creating a global variable 'activeObject', which is set to whatever object is being dragged? And to tell C3 to move an object without actually clicking on it, but by referring to it through a global variable?

    I guess I am not sure yet how powerful functions can be in C3, and to what extent functions can control objects through variables.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could pass ObjectTypeName to a variable (set the variable type as string first) and retrieve it's name.

  • Thanks, will have a look at that!

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