Having a bank system?

Hello! I just want to know how you would integrate a bank like system in your game?

Something like if you collect a lot of coins you can use it for upgrades for your actor to make them better like hill climb or temple run. I want to add the score to your bank every time you play and I want to save your bank so you won't lose all the money.

Example

lets say you scored 20 points and your bank is 0 I want your bank score to change to 20
and if you play again and you score 7 points I want it to add to your bank score so it'll 27 and so on!

For some odd reason I can't figure it out. I know it'll involve a change attribute and some integers. I thought it was simple at first but when I do it it doesn't work properly.

Thanks :smiley:

Comments

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    any one?

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375
    edited June 2014

    This should help.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @bjandthekatz I came into a little problem. I looked at your great template. But how would I add the score to my bank? I tried saying
    Change attribute
    game.bank to game.bank+score but I didn't work. So how would I keep adding the score to my bank?
    Thanks

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375

    You would do it that way. Just make sure to save the coins attribute after adding anything to it. Whenever the shop scene is opened there is a behavior to load the coins attribute last saved.

  • BasGoodboyBasGoodboy Member, PRO Posts: 310
    edited June 2014

    The template is nice for viewing and understanding code. But I woudn't copy paste it. Try to make the code yourself so you understand what you're doing.

    I dont know whats your game about.. But you could do this:

    First make an integer called bank (integer for numbers, so always use an integer here)

    Then, if you collect a coin, by for example reaching a certain level or touching a certain actor (for example an actor with 1 coin on the image), change attribute 'bank' to 'bank+1' or on the actor with for example 5 coins change attribute 'bank' to 'bank+5'.

    Then make another actor called bank with the rule: display attribute 'bank', which will display your bank.

    Then save attribute 'bank'

    Dont forget to make an actor which will load the attribute 'bank' on the scene, so your bank will save and load when exiting and restarting your app.

    Goodboi Gamestudios | Monster Jumper now on the App Store

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @basgoodboy I just didn't think of adding plus one every time you collected a coin. I was thinking of adding the final score to the bank. Thanks

Sign In or Register to comment.