How do I count all gold, from each sprite

0 favourites
  • 4 posts
From the Asset Store
Be quick and count the cards and choose the right number!
  • i have gold, it gets put in the treasure room. it tells me how much gold is in a pile i can pick up the gold, and drop it, it maintains its value. and gold stacks when overlapping.

    but, i want a total owned gold figure.

    i need to check each goldpile.goldinside that is overlapping a treasureroom; and add it up.

    any ideas on how i can check for total gold owned?

    i thought about for each goldpile. set GOLDinDungeon to goldpile.goldinside+GoldinDungeon

    but, will that only work once? do i need to make a function? and call it every time gold is added to a treasure room?

    any thoughts, or easier ideas are welcomed. thank you all

  • Pretty much what you said, for each pile, add to a global variable pile.gold. Did you not try it ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • tested it. nope. as i thought. it just loops the gold adding to total.

    and.. that was just for one gold pile.. total just steadily climbs.

    hmm.. maybe i need a trigger, like gold added, or gold spent to set off the loop from 0 everytime.

    was hoping there was a simpler method is all. mostly as im about to flood fill tileset to get room sizes, so anything i do now may need to be redone

  • Yeah it's like this but you need to run it one time, and also set the variable to 0 right before you run it.

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