Coins
Aadee
Member Posts: 24
Hey, I was just wondering if it's possible to save the coins you have collected in a game. For example let's say you have 3 lives, and in your first life you collect 3/5 coins but then die. When you respond how do you make it so those coins that you collected don't re spawn? I figured out the whole coin count system, I just don't know how to make it so those coins don't reappear.
Comments
You need to save the coin count in a game (global) attribute. These attributes won't be changed when your player dies, so you can use the attribute (variable) to keep track of the number of coins the player collected.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
I'm still a little confused...could you show me an example or something?
Maybe this will help introduce you to attributes in GameSalad.
Essentially, you need to create an integer game attribute called 'coinsCollected' (or whatever you want), and increment that attribute every time the player collects a coin. This way you're keeping track of the coins the player collected.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Thanks a lot, but I understand attributes, I just don't understand how I should save my coins. What do I need to do to make them save? A table or something?
You could put them in a table, or use the 'Save Attribute' behavior.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
How do you insist I do that?
If you google tutorials on Youtube, there are various videos that can help you how to use these behaviors.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Hey, ya I already have and I still am not able to find what I am looking for. I don't know if I a'm looking in the wrong place. Please help! Thanks!
Not sure how else to help you without seeing your logic. Can you post a screenshot?
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Not sure if this is what you're looking for but a demo of one way to accomplish this using a table is attached. I don't have the player dying but instead moving between 2 scenes. Move the white square around with the arrow keys, when you pick up a coin it will record in the table that it's been picked up by writing a 1 into the correct row of the table. Go to the green 'door' to go to scene 2, pick up a coin and use the green door to go back to scene 1. Leave some coins on each scene so you can see that the ones you've already picked up don't show the second time you enter the scene.
Each coin has an Attribute called 'myId' that keeps track of its row in the table. Each coin checks the table when the scene is loaded and if there is a 1 in the table the coin deletes itself so it's no longer in the scene. When the player picks up a coin it writes a 1 into its row in the table so it knows not to show next time the scene loads.
Hope this helps.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
This did very much! Thank you so much!!!
@Aadee, you're welcome!
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
I wrote this up as a tutorial if you're interested in checking out the step by step.
http://jamie-cross.net/gamesalad-persistent-pickups/
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page