Skip to content
← Back to Community
Clicker Game In HTML!
Profile icon
h
has Hacker Plan
Dart

I tried this a few times but now i finally have the hang of javascript (kinda) ill be updating this and add new things/make it look better for now enjoy! :3

-Dart

Voters
Profile icon
ColtonJolly1
Profile icon
ButtonsChrislip
Profile icon
AnteroEncarnaci
Profile icon
ThomasDriver1
Profile icon
mndyhmgnyb
Profile icon
NoahTatum
Profile icon
Utku-YararYarar
Profile icon
JacobBenca
Profile icon
WireBot34
Profile icon
a1cesi
Comments
hotnewtop
Profile icon
MrEconomical

nice game! its pretty good

some critiques for your javascript (sorry if I sound very critical)

  1. += and -= instead of e = e + buttonvalue - its shorter and actually more efficient performance-wise too
  2. you should try to use let for defining variables that can change in the future and const for variables that will not - its just a good practice and also looks cool
  3. try to use else if instead of sticking a bunch of ifs together, its more efficient and also a good practice
  4. use innerText instead of innerHTML - innerHTML makes your sites vulnerable to xss (if somebody inserts malicious scripts and your program puts then directly into the html), innerText interpretes everything as text
  5. don't put semicolons - javascript has ASI (automatic semicolon insertion) that will automatically do them for you. I think it looks cleaner, and if I forgot a semicolon somewhere and I never find the missing semicolon, I could never live with myself lol
  6. use template literals when "adding" strings together - instead of doing "a" + x you can do `a${x}` I think it looks cleaner

I hope these tips help you improve, and good luck to your future javascript endeavors!

Profile icon
syc1

@MrEconomical It's a better habit to add semicolons, it helps if you end up trying other languages like Java, C, C++, etc. Of course, it's not my choice, but I'm just stating a point. Other than that I agree with what you said.

Profile icon
MrEconomical

@syc1 I use c++ and am aware I just don't think its good for js

Profile icon
SilentShadowBla

@MrEconomical Please help me my friend challenged me to make a clicker game with html/js/css and i need help. How do you make a clicks per sec. like how do you make the "cash" automatically go up?
THX in advance :) Btw love your work!

Profile icon
syc1

@SilentShadowBla Use setInterval(function, ms) to change a localstorage value, then when you display balance, show that localStorage value.

Profile icon
Zavexeon

@MrEconomical Don't forget to mention the scope differences between var and let. var is global, let isn't.

Profile icon
Dart

@MrEconomical thanks for the info (especially else if because I couldn’t figure that out 🤦) and I will be changing inner html and with the adding functions I’m still used to python and stuff so I just went with that but I will be improving and I love the criticism thanks for the feedback!

Profile icon
SilentShadowBla

Oh, thanks! @syc1

Profile icon
mwilki7

@MrEconomical
I haven't seen any performance bonuses using var1+=var2 vs var1 = var1 + var2
The compiler should be smart enought to detect that.

Profile icon
MrEconomical

@mwilki7 it actually does make a performance difference with strings
because a += b adds whatever value to the location of the variable a in memory, while a = a + b creates a + b in memory then assigns that to a
it probably won't make much of a difference in js tbh

Profile icon
mwilki7

@MrEconomical
performance results im getting are not describing a difference

Profile icon
MrEconomical

@mwilki7 one of my programs ran twice as fast using += rather than a = a + b

in c++

Profile icon
mwilki7

Would have to look at the program

Profile icon
RohilPatel

Check out my "Grades Clicker". You will have some reference there. @SilentShadowBla

Profile icon
Dart

@RohilPatel is this advertising nah jk your game is pretty good I saw it I wish I had dem css skills

Profile icon
RohilPatel

Yea! I wouldn't have a problem teaching you. Sorry if I gave u the impression that I was advertising... @Zexogon

Profile icon
Navinor

noice game

Profile icon
ChungusFam

This was a great attraction. You deserve my vote. Can you also teach me some JS?

Profile icon
RohilPatel

Haha! I wish I could finish learning myself! @ChungusFam

Profile icon
hazelpy

@ChungusFam There are plenty of tutorials on YouTube, that's where I got started. The rest of it is googling and practice 😅

Profile icon
ChungusFam

Ok thank you.
@hazelpy

Profile icon
Dart

@hazelpy if stack overflow didn’t exist I would die

Profile icon
CyanideREPL

Pretty good. I like it.

Profile icon
AdCharity

cool

Profile icon
Makrayne

You did very well. But I think you should increase the starting price of the autoclicker.

Profile icon
Commodore95

Nice! I enjoyed this very much.

Profile icon
16reevesb

great game

Profile icon
3465728974563

@Zexogon This is pretty cool! Would you like to do a collab? I have a clicker game I'm working on right now and it would be cool to have someone helping me out with it. Interested?

Profile icon
Dart
Profile icon
nN34398Ff

Leave this on overnight
Clicks: Error

Profile icon
staticvoidliam7

i suggest using alert("value")
for when somebody does not have enough "money"

Screenshot 2020-02-13 at 19.09.44

(great game btw)

Profile icon
hazelpy

@LiamDonohue I highly advise against this. Using some fancy CSS and some JavaScript for movement, you can make popups that show up in the bottom of the screen when you don't have enough. Just use position: absolute; and the left and top attributes.

Profile icon
Dart

@LiamDonohue great idea

Profile icon
Dart

@hazelpy i actually like the alert() feature and i think it would be cool to incorporate it (plus im lazy so)

Profile icon
staticvoidliam7

lol css is annoying sometimes @Zexogon

Profile icon
glitchish

this is cool, it's like one of those cookie clickers,
or the community clickers on <scratch.mit.edu>

Profile icon
glitchish
Profile icon
glitchish
Profile icon
Navinor

congrats on 420 cycles

Profile icon
Dart

@Warhawk947 lmao thanks

Profile icon
ThePhoenixfish

I think i spent a little too much time on this xD

Profile icon
syc1

Quick tip: rather than using

Profile icon
RohilPatel

Yea, i would agree in this case, however I'm most I would use a div though. @syc1

Profile icon
Dart
Profile icon
MrEconomical

@Zexogon oh yes I forgot about this definitely use <button> for buttons (when possible) because of a few reasons

  1. its made to be a button bruh
  2. tab doesn't work on divs (when somebody uses tab to select inputs)
  3. it has a bunch of built-in stuff like disabled that divs don't have
  4. easier to style
Profile icon
Dart

@MrEconomical ok thanks!

Profile icon
hazelpy

@Zexogon credit me too, haha I brought it up 😳 I'm just kidding I don't really care

Profile icon
Poggermanz

LOL LMAMAMMAMMAM

Profile icon
CuriousMonkey

im using my own autoclicker xD

Profile icon
[deleted]
Profile icon
MeowcaTheoRange

Hey! It is I, HatKid1.

I don't know why I'm presenting myself like that, I'm not very special.
I remixed YOUR game into something B I G.
An Undertale clicker. With constant updates.
Here's the link if you're interested.

https://underclicker.hatkid1.repl.co/

Sound warning!
See you probably soon!
All credit is due to the original creator and extra asset creators.

Profile icon
aqts

Not bad! Maybe add an animation of the button clicking, that would be great

Profile icon
AlonEyal

cool game!

Profile icon
HackermonDev
Profile icon
thejoeman24

ima get to 30000

Profile icon
thejoeman24

nice game

Profile icon
Aqtion

I love the idea, but if you are able try making the overall layout more appealing. Other than that, great start in js!

Profile icon
Dart

@kbadrinath_tcsp im sory css lord (i do suck at css fr tho TwT)