#### Howdy, Stranger!

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

# math problem

Posts: 41Member

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.

• 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.

• 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.

• Posts: 41Member
edited November 2014

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

@Socks‌ how would you just display?

• London, UK.Posts: 12,822Member

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

Use the Display Text behaviour.

• 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

• London, UK.Posts: 12,822Member

@erkjerk said:
Could you elaborate?

You want me to elaborate on jsorr2's comment ?

• Posts: 41Member

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

• Posts: 2,842Member, Sous Chef, PRO

Here is a starter prototype.

• 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.

• Posts: 2,842Member, Sous Chef, PRO

Maybe this will help:

• Posts: 9,914Member

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.

• 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.

• Posts: 2,842Member, Sous Chef, PRO

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

• 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

• Posts: 2,842Member, 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."

• Posts: 41Member

Worked great thanks

• Posts: 2,842Member, Sous Chef, PRO

You are welcome!