Thursday, February 9, 2012

How to Create a Game in HTML?

For my final proj. in Computer Programing i have to make a basic HTML Jeopardy style game

My teacher gave us no notes! I am a senior who needs these points to graduate and I am not a Computer nerd! Please help me!!!How to Create a Game in HTML?
Can you use JavaScript, or only html? Please update your question with more information and I think I can help you.

note, I just saw this, whenever I wanted to type a ) followed by a semi colon, Yahoo replaced it with an elipse. It did the same with %26gt; followed by a quotation mark followed by a semi-colon. Sorry, you won't be able to cut and paste perfectly. Some assembly required.



Bah... this is irritating .val鈥? is actually dot + "value" + a semi-colon



Okay, I'd do this with a table

%26lt;html%26gt;

%26lt;body%26gt;

%26lt;script language="Javascript"%26gt;

function revealQuestion(r) {

//Sets the interior of the Div to the question you have stored in another div or field

var divMod = document.getElementById(r);

var questionMod = r + "_question";

var TheQuestion = document.getElementById(questionMod).val鈥?br>
divMod.InnerHTML = "%26lt;a href='Javascript:AnswerQuestion("+ r + ");'%26gt;" + TheQuestion +"%26lt;/a%26gt;";



}

function AnswerQuestion(r) {

//will set the contents of the Div to the Answer

var divMod = document.getElementById(r);

var answerMod = r + "_answer";

var TheAnswer = document.getElementById(questionMod).val鈥?br>
divMod.InnerHTML = TheAnswer;



}







%26lt;/script%26gt;

%26lt;table%26gt;

%26lt;tr%26gt;%26lt;td%26gt;Category1%26lt;/td%26gt;%26lt;td%26gt;Category2%26lt;/t鈥?br>
%26lt;tr%26gt;%26lt;td%26gt;%26lt;div id="cat1_100" name="cat1_100"%26gt;%26lt;a href="Javascript:revealQuestion(cat1_100鈥?id="cat2_100" name="cat2_100"%26gt;%26lt;a href="Javascript:revealQuestion(cat2_100鈥?id="cat3_100" name="cat3_100"%26gt;%26lt;a href="Javascript:revealQuestion(cat3_100鈥?br>
%26lt;tr%26gt;%26lt;td%26gt;%26lt;div id="cat1_200" name="cat1_200"%26gt;%26lt;a href="Javascript:revealQuestion(cat1_200鈥?id="cat2_200" name="cat2_200"%26gt;%26lt;a href="Javascript:revealQuestion(cat2_200鈥?id="cat3_200" name="cat3_200"%26gt;%26lt;a href="Javascript:revealQuestion(cat3_200鈥?br>
%26lt;/table%26gt;

%26lt;/body%26gt;

%26lt;/html%26gt;



Now, if it were me I'd make a series of hidden inputs on the page that contained the questions and answers.



Example

%26lt;input type=hidden id="cat1_100_question" name="cat1_100_question" value="The Color Red"/%26gt;

%26lt;input type=hidden id="cat1_100_answer" name="cat1_100_answer" value="What is my favorite color?"/%26gt;



I threw this together so you may need to do a little debugging, but this is fairly close.How to Create a Game in HTML?
To develop a game in HTML (web game) you can use one of these tools (or a combination of them):

- JavaScript (client-side scripting language)

- A server-side scripting language like PHP, Java, Python or Ruby.



In practice for simple games, HTML and JavaScript is enough.

As your teacher did not give you any notes I think you are free to choose the tools. As you assume not being a computer nerd I recommend you to use HTML + JavaScript.



Note that a server-side language would be useful, for example, if you maintained users, scores, etc, in a database.



Give us the game specification and we will help you.
  • window tint
  • trade in value
  • No comments:

    Post a Comment