DEV Community

Anna Taylor
Anna Taylor

Posted on

I wanna build a web game like : Cookie clicker . But I just learnt basic html/css. What am i need learn?

I wanna build a web game like: cookie clicker. But I just learned basic Html/Css. What am I need to learn?

Top comments (4)

Collapse
 
lionelrowe profile image
lionel-rowe

JavaScript.

1 line cookie clicker:

(x=>(x.body.innerHTML='')|x.body.appendChild(Object.assign(x.createElement('a'),{text:'🍪 clicks: 0',onclick:({target:t})=>t.text=t.text.replace(/\d+/,x=>+x+1)})))(document)
Enter fullscreen mode Exit fullscreen mode
Collapse
 
matthewsalerno profile image
matthew-salerno

Probably Javascript. I had a class that did some small games using JavaScript and P5 that culminated in an underwhelming pinball game. Alternatively if you want to start with a ready made engine Godot is fun to work with, too. If it's a simple clicker game though, I think something more lightweight like js would be easier to work with, as you can focus on the language and not get caught up in the editor. P5 has a live editor as well, which is great for toying around with new ideas.

Collapse
 
nickirwin9 profile image
nickirwin9

You need to learn a bit of javascript, especially tracking the mouse click events and incremental functions for scoring and rewards. I made a project cpstest.pro that simply counts clicks and calculates click speed. You can go there and view source code to understand the working. I hope it'll help you with your cookie clicker.

Collapse
 
giorgionetg profile image
Giorgio Tedesco • Edited

Two way to do something like this:

  • A Game Engine (more heavy, less difficult, in example: Godot Engine -> web export)
  • JS and animation library (most light, most difficult)