hello, fellow computer geeks.
I seem to be having a problem with this javascript code. It's for a new game that I am making in cloud9.io's developer.
when I run it, it executes everything up to the document.write("<img src='loading.gif' id='load' />"); and ignores everything else. I can't seem to get it to work at all, and it is really messing me up. Thanks in advance.
<!DOCTYPE html>
<html lang="en-us">
<head>
<title>(it's better fullscreen!)</title>
<script type= "text/javascript">
document.write("<img src='loading.gif' id='load' />");
function weapon(namme, slot) {
this.name = namme;
this.damage;
switch (this.slot) {
case (1): //pistols
switch (this.name) {
case ("pistol cs-barret"):
this.damage = 5;
break;
case ("alien pistol"):
this.damage = 2;
break;
case ("here comes the boom"):
this.damage = 7;
break;
case ("nothing"):
this.damage = 0;
break;
}
break;
case (2): //auto rifles
switch (this.name) {
case ("rifle C-01R"):
this.damage = 3;
break;
case ("alien bubble blaster"):
this.damage = 4;
break;
case ("boom boom boom boom"):
this.damage = 7;
break;
case ("nothing"):
this.damage = 0;
break;
}
break;
case (3): //shotguns
switch (this.name) {
case ("shotgun C-01S"):
this.damage = 3;
break;
case ("alien sheeawtguhn"):
this.damage = 3;
break;
case ("bang bang bang bang"):
this.damage = 8;
break;
case ("nothing"):
this.damage = 0;
break;
}
break;
case (4): //long-ranges
switch (this.name) {
case (".50 cal sniper"):
this.damage = 5;
break;
case ("Holy grail! that's one holy grail."):
this.damage = 70;
break;
case ("nananaa naa, nananaa naa"):
this.damage = 90;
break;
case ("nothing"):
this.damage = 0;
break;
}
break;
case (5): //heavies
switch (this.name) {
case ("EPIC EX PLOAGH SHUN"):
this.damage = 7;
break;
case ("BEEWM"):
this.damage = 8;
break;
case ("HEY HEY HEY, GUDBIGH"):
this.damage = 10;
break;
case ("nothing"):
this.damage = 0;
break;
}
break;
}
this.image = name + ".png";
}
document.write("weapon class, line 99");
function character(namme) {
this.health = 300;
this.name = namme;
this.x = 50;
this.y = 50;
this.imageloc = "player.png";
this.alive = true;
this.weapon[5];
this.weapon[1] = new weapon("pistol cs-barret", 1);
this.weapon[2] = new weapon("nothing", 2);
this.weapon[3] = new weapon("nothing", 3);
this.weapon[4] = new weapon("nothing", 4);
this.weapon[5] = new weapon("nothing", 5);
}
enum direction {
LEFT = "left";
RIGHT = "right";
UP = "up";
DOWN = "down";
}
var fdsa = direction.LEFT;
weapon gun = new weapon("boom boom boom boom", 3);
var name = prompt("What is your name?");
character player = new character(name);
document.getElementById('load').style.display='none'; //remove the loading image from display
</script>
</head>
<body>
</body>
</html>