Live data from Hacker News

Show HN: Looptap – A minimal game to waste your time

looptap.vasanthv.com

101–110 of 183 posts

Re: Show HN: Looptap – A minimal game to waste your time

#102
post #42

One of my favorite things to do with these neat little games is to build something that plays them for me by just pasting stuff into the browser JS console. https://pastebin.com/aTYuaNVS At a score of 1,619 the ball is moving so fast it no longer works! I switched to a new tab (hoping that the event loop would be sent to the background/context switch/whatever) and ta-da - it misclicked. High score of 1,637.

Mine was this

    loopTapApp.startPlay();
    setInterval(() => {
      if(loopTapApp.getBallAngle() > loopTapApp.arc[0] && loopTapApp.getBallAngle() {}, stopPropagation: ()=>{}});
      }
    }, 50);

Re: Show HN: Looptap – A minimal game to waste your time

#103

Simple addictive games like this always remind me of that ball-in-a-cup game that everyone got addicted to in that "The Game" episode of "Star Trek: The Next Generation".

Every time I rewatch that episode it reminds me about when smart phones and social media first swept through, turning people into zombies staring at their phone screens and barely interacting with people physically around them.

Re: Show HN: Looptap – A minimal game to waste your time

#108
post #84
post #51

Earlier quoted context omitted.

You beat me to it, haha, This is what I just did: function intersectRect(rectA, rectB) { return !( rectB.left >= rectA.right || rectB.right = rectA.bottom || rectB.bottom const arc = document.getElementById("arc"); const ball = document.getElementById("ball"); setInterval(() => { if (intersectRect(arc.getBoundingClientRect(), ball.getBoundingClientRect())) { window.dispatchEvent(new KeyboardEvent('keypress', { keyCod…

Oh neat! You did the Harder version and didn't use the game's own code to check it. I find that with JS games it's better to imitate the game's exact logic and call it's functions to make sure the state is working/updates correctly. Of course, for how delightfully simple this one is, your approach is definitely faster/better!

Definitely seems like alfon's solution is faster/better, as it's more accurate when the game speeds up. However, it's also more resource intensive! getBoundingClientRect (used to at least, long time I go I did browser performance stuff) forces a new layout calculation each time it's called, which is one of the most expensive things you can do in the DOM, and can lead to jank in the website. Some more information here: https://developers.google.com/web/fundamentals/performance/r...

Just adding this information for the ones who don't know and like to know more about browser performance :)

Re: Show HN: Looptap – A minimal game to waste your time

#109

It'd be more fun if you somehow got "bonus points" for reducing the time between clicks. I kept playing it safe trying to time the ball but it kind of felt like cheating!

This is in the event handler for the tap: this.score = this.score + (tapInterval

So funny I missed this behavior. Maybe the feedback then is there could be more gradations/tweaking for us slowpokes out there (especially since it appears other folks missed it as well)

Also I should have lead my original comment with kudos to the maker, didn’t mean to only leave (apparently inaccurate) critical feedback!

Post reply on HN