I made an app called Chococalc which works calculates a formula to determine if a dog is sick from eating chocolate. You need to use a LOT of variables.
The iphone/ipod comes with a built in calculator but if you really want to you need to make a lot of variables. heres a sample code.
For the five button If Touch is inside and pressed and phase is equal to one set number 1 to 5 otherwise if phase is equal to 2 set number two to 2 and change phase to 3
Then a display actor with this: if phase is equal to 3 and multiplacation is TRUE, Change result to Number 1* number 2 then display text (result)
In code, say if you wanted a textbox to show numbers in a sequence like that you would have to convert to a string and then back to double if you wanted to do an operation. In c# for example, the code on each button would be Button 1: TextBox1.Text += "1"; 2: += "2"; etc etc.
If it's possible to do similar with the display text behaviour, then try that. Otherwise, I dunno, I never played around with the diplay text behaviour much.
might not be right or any help at all but thought your problem a fun thing to consider.
Could you set up as many attributes as you have keys in your calculator (10 if you are doing 0-9). Also create an attribute as keyPressCounter=0.
Each key would have a attribute value which you would assign to the attribute that matched the keyPressCounter=keypresscounter+1. So if 7 were pressed first it would be assigned to attribute1 and keypresscounter would be 2 when say 5 is pressed.
then you would have to reverse the order when the = button is pressed and multiply the attribute value by 1000,100,10 and 1 say if four numbers were clicked. Then add those attributes together to get you answer?!?
Comments
For the five button
If Touch is inside and pressed and phase is equal to one set number 1 to 5
otherwise if phase is equal to 2 set number two to 2 and change phase to 3
Then a display actor with this: if phase is equal to 3 and multiplacation is TRUE, Change result to Number 1* number 2 then display text (result)
This woulld be a basic set up for a calculator
i'm trying to figure out how to make it so when i hit 1, 2, 5, 8 on the keypad
whatever value is set to 1258
If it's possible to do similar with the display text behaviour, then try that. Otherwise, I dunno, I never played around with the diplay text behaviour much.
Could you set up as many attributes as you have keys in your calculator (10 if you are doing 0-9). Also create an attribute as keyPressCounter=0.
Each key would have a attribute value which you would assign to the attribute that matched the keyPressCounter=keypresscounter+1. So if 7 were pressed first it would be assigned to attribute1 and keypresscounter would be 2 when say 5 is pressed.
then you would have to reverse the order when the = button is pressed and multiply the attribute value by 1000,100,10 and 1 say if four numbers were clicked. Then add those attributes together to get you answer?!?
ANy logic in that rambling?