How do i add a coin system?

Ok so im making my 2nd game on GameSalad, but i've ran into a problem. I can't figure out how to make a coin system, like when a player picks up a coin, the coin count goes up by 1 and the player can later buy things with those coins. I've searched everywhere to look for how to do that, but haven't found the answer. Can anyone show me how i can do this? Thanks!

Comments

  • HappyKat78HappyKat78 Member, BASIC Posts: 173

    This question is a little broad as there is a lot too it. The first part of creating a currency is easy. Setup a global attribute (let's call it "Coins"). When the player (actor) collides with a coin on the scene then change the coins global attribute to coins+1 (or whatever value the coin is worth). That will give you a basic currency.

    For IAP you'll need to set a price for each item that can be purchased and then check the price against the coins attribute to make sure the player can afford it. I would suggest searching the forums and cookbook more around setting up IAP specifically though.

    Cheers

  • ookami007ookami007 Member Posts: 581

    Here's what I do...

    Set a game attribute of COINS. Set it to ZERO.

    When your player actor collides with a coin, add 1 to the game.Coins. The coin will have a collide with player action that destroys itself (so you can't pick it up more than once).

    Later, you can make a screen where if they click on items and if the number of coins they have (game.Coins) is greater than the Cost, then they can buy that item.

  • firezombie444firezombie444 Member Posts: 49

    Ok thanks! I think i get it now, I'll work on it later tonight and see how it goes!

  • jigglybeanjigglybean Member Posts: 1,584

    Like Balls? Then click here! We've 100 coming soon

  • firezombie444firezombie444 Member Posts: 49

    Got the first part done, now working on the shop.

Sign In or Register to comment.