PDA

View Full Version : Help for maths game


awhitestraw
12-08-2008, 06:23 AM
http://i198.photobucket.com/albums/aa312/kayseeleong/Picture1-3.png

Hello people,
I spent probably 6 hours trying to figure this out. This is my layout, and I am trying to do a simple maths game for little kids. So, at the top, you will see a dynamic text space, that's where the maths eq will come out. User will need to click on the right animal for answer.

So for now, I am still trying to find out how I can make the maths eq go on random( I thought of keying a whole lot of maths problems, and then running them on random), and how it will be able to detect whether the right answer was clicked.

Please help:(

Kimchee
12-08-2008, 01:12 PM
First of all, I am a math teacher and got a little worried when I read your post. I thought, oh great another crappy math game, but when I looked at your game it actually looks great! I mean for little kids, it is clean well laid out and actually looks worthwhile. So congrats on that.

Second I don't know how much you know, but here is a function for getting random numbers generated.

Math.ceil(Math.random()*n)

that will give you a range from 1-n.

hope that helps, if not also check out this site.
http://www.flashandmath.com/
It has some really cool things.

awhitestraw
12-08-2008, 05:49 PM
Hi there, I really really appreciate the help you are giving me, and thanks for you kind words. I really would want to see this work. So currently, for my maths eqn, I preset around 15-20 simple maths eqn in my actionscript, and letting go on random mode.

var qtxt=["8-6","4+2","6-1","2+8"];
var outputtxt=["4","6","5","10"];

And I named the animals input_1 and so on, made a variable so that whenever the animal is clicked the number will show on the output dynamic box. ( Quite similar to how a calculator works, excluding all the mathematics involved)

Hmm, but still have some problems here and there. But now the problem is, how do my script detects if the user keyed in the right answers or whatsoever.. I am thinking of the if else statement. Am I right?

Kimchee
12-09-2008, 01:02 AM
yes, an else if would work or you could use cases. Even if your program isn't the most efficient it should work as laid out. Best luck, give us a link when your done :)