So I'm making a satirical cookie-clicker based game as my first ever JS game.
I made a JSFiddle. (The image won't show, but the image is supposed to be a swag hat, which you click to get swag points.) My code is simple so far, but I was wondering why it told me my click() function was undefined. It's mentioned in the head and I don't know what's wrong.
HTML:
<html>
<head>
<title>Swag Dealr</title>
<script src="swagdealr.js"></script>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico" />
</head>
<body>
<h3>SWAG DEALR</h3>
<a href="JavaScript:click()"><img src="img/swaghat.png"></a>
<p>grams of swag</p>
<p id="swagnumber"></p>
<p id=></p>
</body>
</html>
js:
Game={};
Game.Launch = function() {
}
window.onload = function() {
Game.Load();
};
Game.Load = function() {
var swagAmount = 0;
function click() {
swagAmount + (1 * swagMultiplier) = swagAmount;
document.getElementById("swagnumber").innerHTML = swagAmount;
}
}