Any idea on how to create something like a calculator persay

I am attempting to create something that has a text box for inputing numbers like decimal numbers then getting the answer to be divided or other etc... at the end it would show the answer without seeing the math being broken down. only submitting the info on text boxes any way I cant explain it all to well. Any help would be great. tutorial on attributes doesn't show the same thing I'm looking to do, I checked that out already.

Comments

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

    A calculator is a great GameSalad project because there is so much math built into the tool. I'm not sure where you're getting stuck. Do you have a specific question?

    An example for the answer actor might be:

    When attribute game.operation is "multiplication"
         Change Attribute game.answer to game.keyboardInput1 * game.keyboardInput2
         Display Text game.answer

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

  • ArmellineArmelline Member, PRO Posts: 5,364

    One thing to keep in mind when making a calculator app is this:

    The easiest way to handle the typing in of big numbers, e.g. 453, is to use a text attribute to hold the number. Then you can just append each new number to the last, rather than doing maths to keep the tens/hundreds/thousands etc. correct.

    So pressing 4 sets the text attribute to 4, then when you press 5 it sets it to 4..5 etc.

    The only issue you then have is that when you need to put that text attribute into the condition of a rule, you'll end up with "contains" etc. instead of "=" etc. Avoid this by just selecting "Numeric Expression" and putting the attribute in there, rather than selecting it directly.

    If this made no sense now, it will make more sense when you've spent some time on your calculator app :D

  • monsterhybridmonsterhybrid Member Posts: 12

    I will need to experiment a bit. I will get back to you on what exactly I need help with. For the moment I will say I appreciate your help any that you can give.

  • baljettimbaljettim Member Posts: 3

    every time i click on a new number actor it then automatically replaces the text in the attribute with that actor instead of adding to the text attribute.

    click "1" then click "2".... goes to 1 then 2, instead of 12

    please help

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
This discussion has been closed.