Using picked SOL in other parts of event sheet

0 favourites
  • 4 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Is there anyway to send a selected object list to a function, or otherwise use it anywhere else in an event sheet, other than the event it was picked from?

    For example, say I was making a game where I was catching butterflies with a net.

    Let's say that I caught (picked) several of the butterflies on screen with one swing, but I only wanted to keep the largest one.

    I'd want a function like GetLargestInsect, in order to not have a bunch of nasty code with local variables, loops, conditions, in the middle of a simple event like swing net. I could isolate it, and more importantly, I could reuse it, instead having the same code in multiple places.

    Is there any way to send the selected object list to the function, without populating a temporary global array with UIDs?


  • I would give the objects a Boolean instance variable and call it "picked". Just set it to true in any event and you can select the same objects elsewhere by comparing the instance var.

  • Pretty clever R0J0hound, I like your thinking.

    It's still a hack though, opposed to properly referencing an array of instances that already exists.

    It sounds like your idea is the best one so far.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • rexrainbow's Instance Group is very handy for this kind of thing.

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