I would like to create a simple mind game, that includes addition, multiplications, times and divisions.
in this game i like users to answer questions by direct input and at the end of the game, have an update of their performance.
In this game i also like to alert users of wrong answers and display play time and speed.
could you please advise me how i can code this. i am new to making games and is excited to learn how to build games.
I don’t know a whole lot when it comes to game production, but I am thinking you would be better off making this using something other than jQuery, my guess would be Flash maybe? I’m sure it can be done in java, etc, and it has been, but from seeing games in the past, Flash seems to be the most effective.
One option would be to go the Desktop Platform. Such as Java (already mentioned), or you can go the .NET (Windows Forms) route to make your game. It would be much easier for it not to be a web application, if that is possible.
Question: 10 / 10
What is 8 minus 3?
[5 ] [Answer]
You got 8 questions right.
You played for 28 seconds, and took an average of 2.8 seconds to answer each question.
could you please also advice how i can perform the following actions?
(1) after the user’s summary, can i redirect or alert the user to start a new round without having to refresh the webpage?
(2) could i also allow the user to either re-start the same level or move to difficult level or to quit?
(3) also, for advanced level can i allow users to select their (a) type (times, plus, minus or divide), (b) number of questions and (3) time taken to complete it?
I am using this exercise (my main goal is) to develop a better understanding of javascripts, hence, if possible, could you please list the kind of tags that i should be using.
Yes you can, by using a button that would clear the history and then init the game again.
Yes you can, by adjusting minValue and maxValue, and making some level-based changes to the function called valid.
Yes you can. The type of operations is currently picked at random, but a small update would allow you to provide a list of allowed operations, from which one is picked, the totalQuestions variable stores the number of questions, and the start time is recorded, so you can use a setInterval event to compare the elapased time against a desired amount of time for completion.
I am trying to place two sets of form on the same page using different levels. but only the first set of form is working the other ones are not correctly linking, could you please advise what i need to change so that each form is linked to the correct javascript file?
I’m not a Javascript pro (I’m actuallly learning more of it now as we speak via lessons), but I’d do like…if(document.getElementById(“gameLevel1”)){} and use elseifs
Inside the brackets, do whatever code you want. I think using case: could also work here? I think that’s a more optimized version of it?
You should only need the one script, which can be customized for each form.
By changing the id attributes inside of the form to be class attributes instead, you can replace the document.getElementById lines inside of the show function to use form.querySelector instead.
That way when you init the game for each form, the script will be able to easily find the parts that it needs to interact with.
Don’t remove the id attribute on the form tag itself. That’s what is used to tell the script which form to use.
Query selectors also use the same syntax that is used with CSS selectors, such as ‘.first’
OK - i now understand that i need to link questionnumber, first, operator and second to its appropeiate form, but don’t understand how to repeat the entire jave code three times, in the same file, using different rules? and, how to find the correct way to separately identity them?
how can i identify the correct place to call the id, e.g. 'games? For example, i have tried putting the id (‘games’) in the following lines but i got syntax error.
… init: function (form.game)
… get: function (games)
As a second question, could you please suggest a better way to display the following code?
if (Number(question.guess) == answer) {
question.result = true;
alert(' Well done!!! ' + question.guess + ' is the right answer.\
’ );
}
with this code i can inform users of their correct answer - however, ideally it would be better to display this message as a label (read only message) on the html page, rather than forcing the user to click ok, for every correct answer.