How to make coins attribute ?

ofekezofekez Member, PRO Posts: 95

Hello everyone ...
I'm making a game right now and I need to know how to make a coins actor that present the all coins that ever collected ...
Something like (Constrain attribute : Game.Coins to Game.EachGameCoins + ???? maybe ..
If someone can help me on this it will be very nice :) Thanks for all the nice community in this forum ...

BR,

Ofek Ezon

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Instead of constraining it, why not just add the value to game.Coins whenever coins are collected?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ofekezofekez Member, PRO Posts: 95
    edited June 2014

    Can you please give me example ? Because I don't know how to add a value this way ...

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    Hi @ofekez Yes, you've almost suggested your own solution:

    Just use this when you need to update the total amount of coins:

    Change Attribute game.Coins to game.Coins + game.EachGameCoins

    Edit: a suggestion: make your EachGameCoins attribute a scene attribute, that way it'll always be zero at the start of each new level (presuming you mean EachSceneCoins)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • ofekezofekez Member, PRO Posts: 95

    Change attribute or Constrain attribute ?

  • ofekezofekez Member, PRO Posts: 95

    Nvm ...
    Basically i think it's work, but if the EachgameCoins and the Coins are in different scene?
    How to make it work ?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Game attributes can be used by any actor on any scene and keep their values throughout each run of the app. If you are resetting the value of game.eachGameCoins to 0 at the start of each scene/level then you're just adding that value at some point (e.g. the end of the level) to game.Coins which retains its value throughout the game.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ofekezofekez Member, PRO Posts: 95

    I've just tasted it and it doesn't worked , the reason can be the fact that i use a costume fonts to the game.Coins actor and to the game.eachGameCoins actor ?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Costume fonts or custom fonts? If you are using custom fonts then the mathematical expression may be incorrect.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ofekezofekez Member, PRO Posts: 95

    I'm using custom fonts ...

  • ofekezofekez Member, PRO Posts: 95

    Can you please help me with this problem ?

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
  • ofekezofekez Member, PRO Posts: 95

    I don't see anything ... That's the problem ...
    I've make an Change attribute behavior
    (game.Coins to game.Coins + game.EachgameCoins).
    After that I've played the game and i looked at the Coins actor and nothing was in it ...

    Here is a quick video that i just uploaded :

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    It looks like you have the Change Attribute and Save Attribute behaviors (at 0:37 in the video) outside of a rule. They need to be inside of a rule. If they are in a rule (I can't tell from the video and I'm not as familiar with the Windows version of Creator), what is the condition for that rule?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ofekezofekez Member, PRO Posts: 95

    There are 2 rules ...
    1. The move behaviors, Particles, collision with enemy= game.gameover to 1 .
    2. attribute- if game.gameover is 1 then change scene ...

Sign In or Register to comment.