diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-31 19:56:22 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-31 19:56:22 +0100 |
commit | d09c065e1c9600020043cb5f4271b91e5e180d77 (patch) | |
tree | 58a6e1ae78bfb78ee8e0e28c95bebfd7dff3964c | |
download | cookieclicker-d09c065e1c9600020043cb5f4271b91e5e180d77.tar.xz |
Initial commit
-rw-r--r-- | LICENSE | 16 | ||||
-rw-r--r-- | README.md | 7 | ||||
-rwxr-xr-x | cookie.png | bin | 0 -> 52886 bytes | |||
-rwxr-xr-x | game.js | 47 | ||||
-rwxr-xr-x | image.png | bin | 0 -> 52886 bytes | |||
-rwxr-xr-x | index.html | 38 | ||||
-rwxr-xr-x | init.js | 76 | ||||
-rwxr-xr-x | style.css | 6 | ||||
-rwxr-xr-x | table.jpg | bin | 0 -> 76660 bytes |
9 files changed, 190 insertions, 0 deletions
@@ -0,0 +1,16 @@ + + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..d5c2380 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Cookieclicker +A small remake of Cookieclicker + + + +## Context +I made this a few years ago and it was one of the first pieces of code I wrote, so please be gentle when reading the code. diff --git a/cookie.png b/cookie.png Binary files differnew file mode 100755 index 0000000..d8fa54d --- /dev/null +++ b/cookie.png @@ -0,0 +1,47 @@ +messages[1]="First Cookie!"; +messages[50]="Seems like you enjoy the game!"; +messages[100]="One Hundred Cookies!"; +messages[404]="404: Cookie not found."; +messages[777]="Seven-Seven-Seven"; +messages[3000]="You keep doing this!"; +messages[666]="Watch out! Devil's Cookie!"; +messages[123]="...456"; +messages[100000]="Wow. Cheated?"; +messages[911]="Rescue!"; +messages[300000]="Dont you have other hobbies??!"; +messages[54321]="Boom!"; +messages[314]="π"; + +stats[0]={name:"Null",color:"white"}; +stats[1]={name:"Starter",color:"lightgrey"}; +stats[10]={name:"Noob",color:"grey"}; +stats[100]={name:"Klicker",color:"lightblue"}; +stats[500]={name:"Good Klicker",color:"blue"}; +stats[1000]={name:"Master Klicker",color:"darkblue"}; +stats[3000]={name:"Bro",color:"lightgreen"}; +stats[5000]={name:"Crazy",color:"green"}; +stats[7500]={name:"Junky",color:"darkgreen"}; +stats[10000]={name:"Expert",color:"#ffff33"}; +stats[50000]={name:"Pro",color:"yellow"}; +stats[100000]={name:"God",color:"#888800"}; +stats[200000]={name:"Bomb",color:"#ff4444"}; +stats[300000]={name:"Hacker",color:"red"}; +stats[500000]={name:"King",color:"darkred"}; +stats[1000000]={name:"LION KING",color:"black"}; + +statupdates[0]=true; +statupdates[1]=true; +statupdates[10]=true; +statupdates[100]=true; +statupdates[500]=true; +statupdates[1000]=true; +statupdates[3000]=true; +statupdates[5000]=true; +statupdates[7500]=true; +statupdates[10000]=true; +statupdates[50000]=true; +statupdates[100000]=true; +statupdates[200000]=true; +statupdates[300000]=true; +statupdates[500000]=true; +statupdates[1000000]=true; diff --git a/image.png b/image.png Binary files differnew file mode 100755 index 0000000..d8fa54d --- /dev/null +++ b/image.png diff --git a/index.html b/index.html new file mode 100755 index 0000000..2259ed9 --- /dev/null +++ b/index.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html onmouseup="up()"> +<head> + <script defer src="init.js"></script> + <script defer src="game.js"></script> + <link rel="stylesheet" href="style.css"> + <meta charset="utf-8"> + <title>Cookieclicker</title> +</head> +<body> +<center> + + <div id="cookie" onclick="clicked();" onmousedown="down()" ></div> + <br> +<span name="disp"></span><noscript><span name="disp"> Enable Javascript to get</span></noscript><span name="disp"> COOKIES</span><br> +<span id="messages" style="font-family:fantasy;font-size:30px;position:absolute;top:40px;opacity:1;"></span> +</center> +<center> +<span id="playerinfo"> +</span> +</center> +<div style="position:absolute;bottom:55px;left:5px;" name="info"> +<div style="display:inline;background-color:blue;border-radius:50%;"> i </div> +<span>This Website (obviously) uses Cookies to save your Progress. </span><button onclick="document.getElementsByName('info')[0].style.visibility='hidden'"style="color:black;position:relative;top:-1px;background-color:red;border-style:none;border-radius:0%">X</button> +</div> + +<div style="position:absolute;bottom:30px;left:5px;" name="info"> +<div style="display:inline;background-color:blue;border-radius:50%;"> i </div> +<span>Using a autoclicker is silly because if you are hobbyless enough to cheat you can just use the Console. </span><button onclick="document.getElementsByName('info')[1].style.visibility='hidden'" style="color:black;position:relative;top:-1px;background-color:red;border-style:none;border-radius:0%">X</button> +</div> + +<div style="position:absolute;bottom:5px;left:5px;" name="info"> +<div style="display:inline;background-color:blue;border-radius:50%;"> i </div> +<span>Most information on websites is just trash. </span><button style="color:black;position:relative;top:-1px;background-color:red;border-style:none;border-radius:0%" onclick="document.getElementsByName('info')[2].style.visibility='hidden'">X</button> +</div> +<div id="freq"><center><span name="freqdis" style="font-size:100px">0</span><br><span name="freqdis">Clicks per Second</span></center></div> +</body> +</html> @@ -0,0 +1,76 @@ +console.log("Type \"document.cookie=1000000\" to cheat cookies."); +console.log("Now I messed you the whole fun, didn't I?"); +var messages=[]; +var stats=[]; +var statupdates=[]; +var cps=0; +updateCps(); +if(!parseInt(document.cookie)){ + document.cookie=0; + } + setTimeout(updateDisp,100,parseInt(document.cookie)); +function clicked(){ + var cookies=parseInt(document.cookie); + cookies++; + cps++; + document.cookie=cookies; + updateDisp(cookies); + } +function updateDisp(cookies){ + document.getElementsByName('disp')[0].innerHTML=document.cookie.split(';')[0]; + if(messages[parseInt(document.cookie)]){ + document.getElementById('messages').innerHTML=messages[parseInt(document.cookie)]; + anim(); + } + var stat=stats[statupdates.lastIndexOf(true,cookies)]; + document.getElementById('playerinfo').style.backgroundColor=stat.color; + document.getElementById('playerinfo').innerHTML=stat.name; + if(stat.name==="LION KING"){ + document.getElementById('playerinfo').style.color='white'; + } + } +var theCookie=document.getElementById('cookie'); +function down(){ + theCookie.style.width="180px"; + theCookie.style.height="180px"; + theCookie.style.top="10px"; + } +function up(){ + theCookie.style.width="200px"; + theCookie.style.height="200px"; + theCookie.style.top="0px"; + } +function anim(){ + var cont=true; + var fs=parseInt(document.getElementById('messages').style.top.replace(/px/,'')); + document.getElementById('messages').style.top=fs+5+"px"; + if(fs>=100){ + document.getElementById('messages').style.opacity-=0.01; + } + if(fs===600){ + document.getElementById('messages').innerHTML=""; + document.getElementById('messages').style.top="40px"; + document.getElementById('messages').style.opacity=1; + cont=false; + } + if(cont){ + setTimeout(anim,20); + } + } +function updateCps(){ + document.getElementsByName('freqdis')[0].innerHTML=cps; + switch(cps){ + case(0):{col="#1000f0";break;} + case(1):{col="#3000d0";break;} + case(2):{col="#5000a0";break;} + case(3):{col="#700090";break;} + case(4):{col="#900070";break;} + case(5):{col="#a00050";break;} + case(6):{col="#d00030";break;} + case(7):{col="#f00010";break;} + default:{col="#f00000";break;} + } + document.getElementById('freq').style.backgroundColor=col; + cps=0; + setTimeout(updateCps,1000) + } diff --git a/style.css b/style.css new file mode 100755 index 0000000..42c9290 --- /dev/null +++ b/style.css @@ -0,0 +1,6 @@ +body{background-image:url(table.jpg)} +#cookie{height:200px;width:200px;border-radius:50%;background-image:url(cookie.png);position:relative;cursor:pointer;background-size:cover} +[name=disp]{font-family:fantasy;font-weight:bold;font-size:50px;} +#playerinfo{background-color:white;position:absolute;top:30px;left:30px;width:500px;height:65px;font-family:fantasy;font-size:50px} +#freq{width:200px;height:200px;position:absolute;top:5px;right:5px;background-color:green} +[name=freqdis]{font-family:fantasy} diff --git a/table.jpg b/table.jpg Binary files differnew file mode 100755 index 0000000..645e63f --- /dev/null +++ b/table.jpg |