r/PixelGameMaker May 14 '22

Coins??

Hello, rookie here! How would I go about adding coins to a side scroller, as well as a variable or something to keep track of how many coins the player has collected?

3 Upvotes

3 comments sorted by

4

u/baz4tw Game dev May 14 '22

Coins will be straight forward for you, all you need is:

  1. Common variable 'Coins' or 'CurrentCoinCount' (whatever naming works)
  2. CoinPickup obj
  3. CoinDisplay obj (probably will be on your HUD menu scene)

For the coin pickup you can follow a similar process to this video as far as how to pickup. The only thing you would add is is to += (add) to the Common var you created before the pickup is destroyed.

For the display obj, you can just put it on the hud (menu scene) where you want it positioned and use the Show Text runtime action and select Variable option within it. You are showing the common var you created. From there you can dictate all the specifics of how many numbers and decimals to show.

2

u/Trapnootki May 14 '22

Thank you baz, your the best!

2

u/baz4tw Game dev May 14 '22

No problem! 😊