Best Practice: doing some maths or physics test? (Educational game)

Started by Zauberlehrling, Tue 07/02/2017 19:07:31

Previous topic - Next topic

Zauberlehrling

Hi,

I'm writing a little game so my pupils can only win, if they do some tests inside the game right.
Something like:

v=s/T

Q=c * m * delta T

Ok.
Now I think hard coding this inside the game is pretty odd, because if one pupil has got the right answer, of course the answer would be shared.
So, I'm thinking of using random numbers for the different questions:
m could e.g. be anything from 5-15, delta T anything from e.g. 17 to 34..., c is constant though.

Now my question:
Is it better to make one room (after starting screen e.g.) and put all those random calculations inside this one room (so they are all handy in one place) and define the data as global variables, or should this be done when necessary in the respective rooms?

Pro one room:
Values for one game stay the same (don't know if this it pro?)
Everything in one place
Better to mange all different questions / values and formulas

Contra:
Lots of global variables needed
How to deal with things like m (weight), if it is used with different values for different questions? (the player should get the right value for having a chance...)


Oh, my idea was to give a input box and compare the entered value with the right one. Any better ways of doing this?


Thank you in advance

Zauberlehrling

cat

I guess it depends on how your game should work and look like.

Do you want to have a certain background for each formula? For example, in the v=s/T room show a racing car or something. Then it might be easiest to have one room per question. You can then store the randomly generated values in variables.

If your background always stays the same and you display random questions for random formulas after each other, you might want to have a look at modules. They are a neat way to manage code that belongs together and you don't need global variables.

You can use the giveScore feature to count points for correct questions :)

Zauberlehrling

Thank you very much.

Ok, so you tend to the each-room version.
The game should look and feel like a classical adventure game. Can't upload images, otherwise I'd have shown you a little picture of what it looks like at the moment.

SMF spam blocked by CleanTalk