GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

math problem

How would you make just a simple addition problem in GS. For example a input box that they put a number in and another one and it displays the answer. It can be addition, multiplication, etc.

Comments

  • jsorr2jsorr2 Posts: 279Member

    so you want a calculator?

    well have 3 attributes X + Y = Z.

    Logic:
    X = keyboard input
    Y = second keyboard input
    Z = x + y

    Then in an actor, display Z's value when a button is pressed.

  • SocksSocks London, UK.Posts: 12,822Member

    @jsorr2 said:
    so you want a calculator?

    well have 3 attributes X + Y = Z.

    Logic:

    X = keyboard input

    Y = second keyboard input

    Z = x + y

    Then in an actor, display Z's value when a button is pressed.

    You wouldn't really need an attribute for 'z', you could just display x+y.

  • erkjerkerkjerk Posts: 41Member
    edited November 2014

    @jsorr2 sorry, could you elaborate - kind of confused, thanks.

    @Socks‌ how would you just display?

  • SocksSocks London, UK.Posts: 12,822Member

    @erkjerk said:
    Socks‌ how would you just display?

    Use the Display Text behaviour.

  • erkjerkerkjerk Posts: 41Member

    @Socks‌ thanks. I am confused by what jsor
    ment. Do I make an attribute and put keyboard function in that? Not sure where to put the addition forumla. Could you elaborate? Thanks again for the help

  • SocksSocks London, UK.Posts: 12,822Member

    @erkjerk said:
    Could you elaborate?

    You want me to elaborate on jsorr2's comment ? :)

  • erkjerkerkjerk Posts: 41Member

    @Socks‌
    Ya if you understand it lol. Unless you can let me know a way I can do it hah

  • RThurmanRThurman Posts: 2,824Member, Sous Chef, PRO

    Here is a starter prototype.

  • erkjerkerkjerk Posts: 41Member
    edited November 2014

    @RThurman‌

    First, thanks for the help.

    It says "Unsupported file format. The file is newer than this version of Creator."

    I have 10.5 installed for PC.

  • RThurmanRThurman Posts: 2,824Member, Sous Chef, PRO

    Maybe this will help:

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member

    You need two variables to store info. The input just doesn't float around in there.

    So here is a simple function using two game level attributes. One called x and one called y

    Actor 1
    When touch is pressed

    Keyboard input to X

    Actor 2
    When touch is pressed

    Keyboard input to Y

    Actor 3

    Display text

    Game.x +game.y

    That's it.

  • erkjerkerkjerk Posts: 41Member

    @RThurman‌

    That is exactly what I am looking for, however how do you make it not rand generate, looks for when the box is touched, the user can input a number.

    Thanks guys for the help.

  • RThurmanRThurman Posts: 2,824Member, Sous Chef, PRO

    Replace the "Change Attribute" action with a "Keyboard Input" action.

  • erkjerkerkjerk Posts: 41Member

    @RThurman‌

    so put the game.a under the "change the ffollowing attribute" ? Or under "which prompts user with"?

    Thanks for the help appreciate it

  • RThurmanRThurman Posts: 2,824Member, Sous Chef, PRO

    Yes, game.a is the attribute.

    You can type any thing you want into the "prompt" section. For example you could type, "Enter a number between 1 and 100."

  • erkjerkerkjerk Posts: 41Member

    Worked great thanks

  • RThurmanRThurman Posts: 2,824Member, Sous Chef, PRO

    You are welcome!

Sign In or Register to comment.