heb wat problemen met simpele console game, als ik help intik als command doet hij niks...
index.html code
Code:
<html>
<head>
<script type="text/javascript" src="scripts/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Console Game Project</title>
</head>
<body>
<div id="console">
<p id="message_startgame">Welcome to Nieli's game! To control the game you must type in commands</p>
<p id="area_northcorridor">You are in the north door. There is a sword on the ground.</p>
<p id="message_help" style="display: none;">Here is a list of commands</p>
<!--
PLACEHOLDER: THIS IS WHERE EVERYTHING WILL BE INSERTED BEFORE
-->
<div id="placeholder"></div>
<form onsubmit="return false;">
<input type="text" size="50" autofocus="autofocus" id="command_line" />
</form>
</div>
<script type="text/javascript" src="scripts/game.js"></script>
</body>
</html>
game.js code
Code:
//been to variables
beentonorthdoor = true;
//
//Item variable
sword = false;
//
//Current room
currentroom = "n_corridor";
//
$(document).ready(function() {
$("form").submit(function() {
var input = $("#command_line").val();
if (input == "help") {
$("#message_help").clone().insertBefore("#placeholder").fadeIn(1000);
}
$("#command_line").val("");
}};
}};
Denk dat de fout hier ergens zit:
Code:
$(document).ready(function() {
$("form").submit(function() {
var input = $("#command_line").val();
if (input == "help") {
$("#message_help").clone().insertBefore("#placeholder").fadeIn(1000);
}
$("#command_line").val("");
Maar kvind hem niet :S
Kan iemand helpen