Banking System

I'm curious as to how I would go about generating a numerical counter that would reflect the amount of coins or money a player has.

Hypothetical:

A tower defence game where the player on a particular level starts with 100 coins.

Towers cost say 50.

Once you have purchased two towers you cannot build anymore towers.

When an enemy is destroyed there would be a rule to generate say 20 coins and this would grow.

My question is, how do i insert an actor that is a money counter that will grow or diminish based on the users actions?

Even if this may not be possible, any response would be greatly appreciated. :)

Comments

  • mataruamatarua Auckland, New ZealandMember Posts: 854
    Totally possible - I have many many currencies for many more characters.

    Tables is the answer.

    You can write your data to tables and save data and retrieve data and it all gets remembered. Attributes do not do that - so learn about tables.

  • jacobsondjacobsond Member Posts: 3
    Cool, I'll have some homework for tonight then.

    Cheers
  • kinzuakinzua Member Posts: 554
    You need an Attribute, not an Actor.
    Create an 'Integer Attribute' called CoinStack.
    Then in One of the actors you'll add an expression 'Change Attribute' and say,
    When you add coins you say 'CoinStack = CoinStack + X'
    When you minus coins you say 'CoinStack = CoinStack - X'
    where X will be the value that you add or subtract.
    As easy as that.
  • kinzuakinzua Member Posts: 554
    Cool, I'll have some homework for tonight then.

    Cheers
    By the nature of your question, i believe you have a lot of homework to do.
    Best of luck buddy. ;)
  • -Timo--Timo- Member Posts: 2,313
    You need an Attribute, not an Actor.
    Create an 'Integer Attribute' called CoinStack.
    Then in One of the actors you'll add an expression 'Change Attribute' and say,
    When you add coins you say 'CoinStack = CoinStack + X'
    When you minus coins you say 'CoinStack = CoinStack - X'
    where X will be the value that you add or subtract.
    As easy as that.
    this is the solution :)

    and if you want to see how much money you have while playing just place an actor and display the text of game.CoinStack
  • jacobsondjacobsond Member Posts: 3
    Thanks heaps guys, the tutorials are amazing, so is the community. I started working with game salad 2 days ago and it's functionality and ease of use astound me
Sign In or Register to comment.