Handling Multiple Objects

0 favourites
  • 11 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • I'm pretty impressed with Construct2 so far and the amount I've been able to do in a short amount of time. Here's something I'm struggling with on my first game, however.

    Is there a way to apply a condition to multiple objects? For example, if any item with the drag behavior is dragged, make it 50% transparent?

  • You can stick them all in a single family, then apply the condition checks to that family.

    Drag Item #1 is in Family "Drag"

    Drag Item #2 is in Family "Drag"

    if Family "Drag" is being dragged, set opacity to 50%

    Something like that.

  • You can stick them all in a single family

    If you have a license, that is. <img src="smileys/smiley1.gif" border="0" align="middle" />

    If not, you could use a global variable that is changed when you drag an object. And then set opacity to 50 when the variable is 1,

  • Great to know! I haven't bought a license yet, I was trying to see how far I could go without it. I'm pretty sure I'm going to make the leap. Is there any documentation on how the family system works?

    Nimtrix If I do it that way, I'll still have to duplicate the settings for every object right?

  • Shouldn't have to, have a look at this:

    Dropbox: Drag Drop Example

  • quick and simple :))

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What if I want to drag both an orange and an apple. If I'm dragging the orange, won't the apple turn transparent too if I do it this way?

    In other words, how do I say "Whatever current item is dragged, make it 50% transparent"?

  • If you want all the apples to turn transparent when you lift one apple, and all the oranges to turn transparent when you lift one orange, you probably have to make events and variables for each type of object. Like this

    If you just want the single apple/orange to turn transparent, you don't even need variables, but I'm guessing that's not what you're after.

  • The second case sounds more like what I'm trying to do.

    I'll have apples, oranges, dominoes, books, knives. The item being dragged needs to have several properties (transparency is the example).

    What I'm trying to figure out is how to not have to program 25 different items differently when they'll behave the same. They'll have different sprites and physics properties.

    Sorry if I'm not explaining this well. I looked at the Families example that comes with C2. It sounds like that might really be what I need if I want to be efficient

  • I looked at the Families example that comes with C2. It sounds like that might really be what I need if I want to be efficient

    Ah, i see. You're quite right, you'll need families to do that efficiently. Gonna have to buy I guess. <img src="smileys/smiley2.gif" border="0" align="middle" />

  • Yep, just went ahead and did it. I planned to anyway at some point. Thanks for your help, definitely did learn a few things from your examples.

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