adding a special money system to my game to unlock potential characters

digitalzerodigitalzero Posts: 620Member, BASIC
edited May 2012 in Working with GS (Mac)
I'm having a bit of trouble... I'm trying to add a attribute that will allow my characters to get the items in the game in order to buy certain characters... i guess the best example that i can give is the jet pack joyride where you are able to collect coins in the game in order to buy in the shop... i have something like this already

i have an attribute labeled coins and each time the character overlaps or collides it would change the attribute game.coins to game.coins+1 and i have a save attribute before the character dies

the problem that I'm having is that when it goes to the beginning scene... (the scene where it displays how much coins you have made) it only shows the coins that you have made the last time you played and its not adding everything up everything so the character will not be able to make the coins that the character needs to :( kinda frustrating but i believe that all the rules that i have set up are correct so can someone please let me know what I'm doing wrong.


  • digitalzerodigitalzero Posts: 620Member, BASIC
    I'm still a little confused with that... what happens when i need to reset the game at the end when the player looses because i have the "best score" at the end (that i actually followed from one of your tutorials) and after that scene is pressed it goes to the screen where you are able to see the coins... where exactly would i put a save attribute and a load attribute for the both of them so that it keeps on saving as the time goes along because how i have m game set right now it should seem like the "total coins" would be the same thing that I'm using as the regular coin attribute i have... I'm not really worried about the resetting of the coins i just want it so that if the player dies it would still have the set number of coins added and not just the last time the character gained when they were receiving the coins. i don't know if i explained that right but i hope that you get my drift.
  • jckmcgrawjckmcgraw Posts: 647Member

    I'm sorry, but I can't make much sense of the three, run-on sentences you have in that paragraph.
  • digitalzerodigitalzero Posts: 620Member, BASIC
    lol sorry it was about 5 am in the morning and i was getting sleepy at that point LMAO. but okay... basically what i would like to happen is for the character to collect the coins and have the coins added up to the game so that the player can unlock different characters. NOW.. what is actually happening is that the character collects the coins... it saves and shows how much coins that you have collected when the game either resets or you turn your iPhone off. THIS IS WHAT IM TRRRRYYYIIIINNNNGGGGG TO DO!

    this is what is happening... the coins are saving but the coins that you have collected are not adding... it just always adds up the last time you have got any coins.

    like i said the best example that i can give is jetpack joyride... how you are able to collect the coins and then buy items in the shop... essentially I'm trying to do just that!
  • Braydon_SFXBraydon_SFX Posts: 9,002Member, Sous Chef, PRO, Bowlboy Sidekick GameSalad Employee
    edited May 2012
    If I have time, I'll make a quick demo.
  • Braydon_SFXBraydon_SFX Posts: 9,002Member, Sous Chef, PRO, Bowlboy Sidekick GameSalad Employee
  • digitalzerodigitalzero Posts: 620Member, BASIC
    okay i get that tutorial and thats pretty much what i have set up in my game but out of this download let me give you an example of what I'm talking about...

    okay lets just say that i keep on tapping to gain coins up to 30

    the next time i keep tapping and i gain 5 coins

    what i would like to do is for the score to be 35 coins not my last score of coins which would be 5... does that make sense... i feel like i did justice with this explanation lol
  • Braydon_SFXBraydon_SFX Posts: 9,002Member, Sous Chef, PRO, Bowlboy Sidekick GameSalad Employee
    So you don't need the total coins..just the coins.
  • digitalzerodigitalzero Posts: 620Member, BASIC
    yeah but i have a reset apparent in my game when the character looses but right before the reset i also have a save attribute slightly before that... but it displays the coins on the beginning title screen but it does not add up all the coins from the previous times played... for example

    lets say that i have made 30 coins the first run... and after that i loose...

    the next game lets say that i make 20 coins... and then after that i loose

    it will display the last coins that i have made which would be 20... rather than the total amount that i have made throughout the whole process of me downloading the game which should be 50...

    i guess i need to call on @MotherHoose to help me out with this
  • MotherHooseMotherHoose Posts: 2,456Member
    the save/load attributes you have in your game may be working when actual game is on device

    (Preview is a developmentTool … when we exit Preview … things are reset to the development values … the state of the game with our original programmed values)

    GS Viewer is a testing tool … try your save/load code there
    … or publish a Macintosh build … and test that build on your desktop

    to decrease the load on your playerActor … have the coinActors add to the score

    image MH
  • digitalzerodigitalzero Posts: 620Member, BASIC
    well I'm testing it out on my device... but its kinda weird that gs would allow me to see the attributes but its just simply not adding things up i just need for it to always add the coins no matter if the game restarts or not but it always just gives either the last score or the highest score... which is quite bothering!
  • MotherHooseMotherHoose Posts: 2,456Member
    where is your load behavior occurring?
    and does each saved attribute have just one load? … at the start of the game?

    check those behaviors again …
    add displayText for each (sceneCoins; totalCoins) … to verify they are adding

    @digitalzero … are we at the point … where you send us your projectFile?

    image MH
  • digitalzerodigitalzero Posts: 620Member, BASIC
    I'm almost at the point where i can send the program file because everything else is done i think... well maybe not lol...

    so this is what i have placed

    in the beginning of the game i have the load attribute for the game.catcoins

    before the end of the scene where the actor that triggers the "you lose" screen i have placed a save attribute...

    when you go to the "you lose" screen if you tap it i have a rule placed that if its tapped then it will reset the game...

    and of course when the game is reset it goes back to the title screen which has the load attribute game.catcoins

    is there something wrong where those are placed? because i do not mind throughout the game having it saved and not reset back to zero... i just wanna assure that the game is able to constantly updating the cat coins because its very imperative that the player is able to collect those because i have unlockable characters. i read the youtube tutorial with @TshirtBooth in it about the save and load attribute as well as the how to save a high score (which worked out perfectly by the way) but i just need to have the score that you added to the total cat coins without resetting all the time

  • MotherHooseMotherHoose Posts: 2,456Member
    all that should work!

    but … maybe try a saveBehavior just before the resetBehaviors in the "you lose" screen

    image MH
  • digitalzerodigitalzero Posts: 620Member, BASIC
    you know what @MotherHoose... you are a genius! i just simply had to put a save attribute at the "you lose" screen... thats it! i been working on that for 2 weeks! and you finally directed me to it! its simple things like that, that has me confused and hinders my projects and their completion! thank you so much @MotherHoose! I really appreciate it! and as soon as i get done with this video game (which should now be within the next couple of days i will tag you in the post to announce my game! thanks so much!
This discussion has been closed.