I have tried to make a clicker game with a basic way to tell if the game has been cheated with variables but it just doesnt work right even after intentionally cheating to test it.
Heres my HTML code: (has the js)
var i = 0;
function myFunc() {
var one = document.getElementById("one");
if (one.innerHTML == "Click the button to get your first dimension!") {
one.innerHTML = "You have one dimension."
} else {
a = i
b = a + 1
i += 1;
if (i == b) {
alert("No Cheats")
} else {
alert("Cheater!")
}
one.innerHTML = "You have " + i + " dimensions."
}
}
#one {
width: 200px;
height: 200px;
border: 1px solid blue;
}
button {
width: 200px;
background: yellow;
box-shadow: 4px 4px 4px #333;
}
<!DOCTYPE HTML>
<title>Clicker</title>
<noscript>turn on javascript man</noscript>
<head>
</head>
<html>
<body>
<div id="one">Click the button to get your first dimension!</div>
<button onclick="myFunc()"> Dimension Creator </button>
</body>
</html>