Access global variables (not instances)

0 favourites
  • 4 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'm trying to write a plugin that can procedurally generate levels based on the position of sprites in the previous level. To do this I need to be able to access the relative positions of the sprites each time the level changes--in the SDK I've only seen examples of modifying the instance of the object that the behavior is applied to.

    Is there a way to do this? Thanks.

  • you'll need to grab those positions before the layout changes. construct doesn't automatically save the previous object positions like that. Make a plugin with an action that has an object type param, and save the positions of all the objects picked into an array or js object, then process them in the next layout by making your object global or saving the array to some global js object.

  • Alright, thanks.

    What exactly would the code be to store all the instances currently on the screen into an array? I still can't figure out the code to grab all of the objects.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • i don't know off the top of my head, but theres a list of instances which you can get from the js object for a particular type which is passed in from the object param.

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