Education math game need help with creating equation
by Carlos A. Plata Jr. · in General Discussion · 04/05/2007 (3:11 pm) · 5 replies
I am trying to create an educational game that will present an addition or subtraction equation. I am having a hard time trying to figure out how to write a script that will randoming choose a number between 0-20 for the first field, a + or - for the second field and a number between 0-20 for the third field. after the equation has been dispalyed the player must enter the answer using the keyboard. if the answer is wrong the equation turns red if correct the anwer turns green. I just need any suggests as to how to code using torque to create the equation. Thanks
#2
04/05/2007 (6:46 pm)
Thanks for the code, how would I get this to display on to the level?
#3
i would refer you to check the rest of the site for beginner's guides,
or a copy of the book The Game Programmer's Guide To Torque.
04/06/2007 (12:10 am)
Heya -i would refer you to check the rest of the site for beginner's guides,
or a copy of the book The Game Programmer's Guide To Torque.
#4
04/06/2007 (6:06 am)
It funny that you mention that book, I was looking to purchase it, however I was not sure if it covered TGB, I though it may just cover TGE. Thanks again
#5
however it's an excellent guide to TorqueScript, which is common to both.
04/06/2007 (8:40 am)
Hi - sorry, i assumed you were working with TGE. the book is definitely about TGE,however it's an excellent guide to TorqueScript, which is common to both.
Associate Orion Elenzil
Real Life Plus
function getExpression() { %n1 = getRandom(0, 20); %n2 = getRandom(0, 20); %operation = getRandom(0, 1) ? "+" : "-"; return %n1 SPC %operation SPC %n2; } function solveExpression(%expression) { %cmd = "%answer = " @ %expression @ ";"; eval(%cmd); return %answer; } function printExampleEquation() { %expression = getExpression(); %answer = solveExpression(%expression); echo(%expression SPC "=" SPC %answer @ "."); }