Counter wont count

somersetjc

  • Posts: 40
I am making a game in which there is a counter right under the level button that displays how many of the main collectable the player has gotten. For some reason it always stays on zero. Here are the blocks. Cargo counter is the attribute which tells how much of the cargo (the collectable) was collected. The once cargo is the game attribute that saves the data in a game attribute. The counter actor is in the counter one group. Please help me. Thank you.

dtrungle

  • *
  • Posts: 1938
When an item is collected, record that in a game attribute. When you want to display how much was collected, read the game attribute and display it. That is the basic idea.

From what I can tell, you are not grabbing the game attribute, and you probably overwrote the game attribute considering the behavior attribute is probably defaulted to 0.

somersetjc

  • Posts: 40
When an item is collected, record that in a game attribute. When you want to display how much was collected, read the game attribute and display it. That is the basic idea.

From what I can tell, you are not grabbing the game attribute, and you probably overwrote the game attribute considering the behavior attribute is probably defaulted to 0.

I made it so when the item is collected it changes the game attribute but it still stays at 0. PLease Help!

Photics

  • *
  • Posts: 718
When an item is collected, record that in a game attribute. When you want to display how much was collected, read the game attribute and display it. That is the basic idea.

From what I can tell, you are not grabbing the game attribute, and you probably overwrote the game attribute considering the behavior attribute is probably defaulted to 0.

I made it so when the item is collected it changes the game attribute but it still stays at 0. PLease Help!

That doesn't seem like a very efficient way of doing the math. A good guide in computing, if you're doing lots of repetitive work – you're probably doing it wrong.

Why not just always set "One Cargo" to "Cargo Counter", since that's what you appear to be doing? Even if you want to continue using the method you're using, it breaks around 6-7, as you have 7 inside of 6.

Why are you using two separate attributes, since they are being changed to the same value?
Michael Garofalohttp://photics.com – Author of The Interactive Stencyl Textbook 8)

dtrungle

  • *
  • Posts: 1938
In case you are opening and closing the game, you need to save and load your save file - it holds your game attributes.

To lay it out clearer for you.

Scene to collect the item.
When item is collected, get ga_count, add 1 to ga_count, set ga_count to the new value.

Scene that shows level select.
On load, get ga_count and show it. Example would be draw ga_count under button.

Have another look at Stencylpedia if you don't understand something.

TheIndieStation

  • *
  • Posts: 2261
You got a mistake there >> http://gyazo.com/570ee8cecd3aae1039d472309b96eccd
But you can also just say:
Set One Cargo to Cargo Counter