How do I get selected sprites to add to global variable?

0 favourites
  • 5 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.
  • C3! How the heck are ya?

    In my little project, I want to have the sprites with animation 1 showing to add to totalups (global number) or add 1 to totaldowns (global number) for animation 2. That works but it seems no matter how many sprites I have showing animation 1 or 2, the rate that the number goes up is the same.

    I'm including the scaled down, simplified version of what I'm using in my project since I was able to replicate my coding inability.

    I appreciate any and all help/suggestions.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your current conditions are saying if any sprite exists with animation1 set then add 1 and the same for animation2 so I imagine they just increase by 1 every 1 seconds. The fix for this is actually to replace add 1 with add sprite.pickedcount. Pickedcount is the number of sprites currently set to that animation.

  • Your current conditions are saying if any sprite exists with animation1 set then add 1 and the same for animation2 so I imagine they just increase by 1 every 1 seconds. The fix for this is actually to replace add 1 with add sprite.pickedcount. Pickedcount is the number of sprites currently set to that animation.

    Ooohhh.....yeah that sounds like exactly what I'm looking for. Thank you! However...where would one find that "pickedcount" and use it?

    Further digging yielded it. Testing now.

  • What I came up with. This works with a rate of 1 increased per pickedcount. I'm assuming -> Add rate*(sprites.pickedcount) if I wanted it to increase by a different rate other than 1?

    Please confirm if it's applied correctly. Thank you!!

  • Pickedcount is the total number of instances that you picked, so in this event it is the number of instances with animation frame 1 and in the second event the number of instances with animation frame 2. That's what you wanted, right? To add the total number of instances that matched.

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