Live data from Hacker News

Show HN: I taught my little brother JS, and he made this videogame in a week

s-poony.github.io

211–220 of 285 posts

Re: Show HN: I taught my little brother JS, and he made this videogame in a week

#211

Snowcrash mode :) (In console): setInterval(function() { hero.x = powerUp.x; hero.y = powerUp.y; }, 50); setInterval(function() { hero.x = reward.x; hero.y = reward.y; }, 100);

I did the same, but played around a bit more and made an "AI" mode: maxScore = 0; setInterval( function() { if (score > maxScore) { maxScore = score; } if (distance(hero.y, hero.x, ennemi.y, ennemi.x) PowerUpspawnRate) { hero.y += (powerUp.y - hero.y) * speedLimit / distance(hero.y, hero.x, powerUp.y, powerUp.x); hero.x += (powerUp.x - hero.x) * speedLimit/ distance(hero.y, hero.x, powerUp.y, powerUp.x); } else { her…

I love when the red square comes close and the green one jukes in a tight spiral around it, just thinking "Whoa nope nope NOPE ah it's okay"

Re: Show HN: I taught my little brother JS, and he made this videogame in a week

#212

Earlier quoted context omitted.

What would one feasibly do with this data? I guess an app could tell if someone is holding their phone in their had, and maybe put together a pedometer bases on gyroscope input. Maybe a concern if a app has access to gyro input over a period of days. But as long as it's only for actively open apps and web pages I don't really see much harm.

The gyroscope is a datapoint that can be used for fingerprinting. Plus it gives quite a bit of information about you: whether you are lying down, sitting, walking, etc.

doesn't this assume the user is walking around with the page open, the front tab, and the phone unlocked for a reasonably long period? which websites do I spend enough time on for that to be true? I don't generally walk and read

Re: Show HN: I taught my little brother JS, and he made this videogame in a week

#214
post #91

Earlier quoted context omitted.

I don't understand, am I missing something? You just pick up blue and teal blocks while a red block slowly chases you? Why are people so excited about this? I feel like I'm missing something.

Did you try it on the phone, using tilt? Other than that - yeah, that's all there is to it.

The red block gets faster and faster, introduction of smaller squares worth ten points, it became quite a challenge for me to keep a score above 100 on PC with arrow keys.

Re: Show HN: I taught my little brother JS, and he made this videogame in a week

#215

Earlier quoted context omitted.

I did the same, but played around a bit more and made an "AI" mode: maxScore = 0; setInterval( function() { if (score > maxScore) { maxScore = score; } if (distance(hero.y, hero.x, ennemi.y, ennemi.x) PowerUpspawnRate) { hero.y += (powerUp.y - hero.y) * speedLimit / distance(hero.y, hero.x, powerUp.y, powerUp.x); hero.x += (powerUp.x - hero.x) * speedLimit/ distance(hero.y, hero.x, powerUp.y, powerUp.x); } else { her…

I love when the red square comes close and the green one jukes in a tight spiral around it, just thinking "Whoa nope nope NOPE ah it's okay"

LOL yeah, it's like watching a sport. By about a score of 300 the enemy is just too fast for our hero. =/

Re: Show HN: I taught my little brother JS, and he made this videogame in a week

#216
post #176

Look at the code guys [1]. I love it. This is simple. There is not a single line of bullshit. I hope he gonna become a great programmer and continue to make beautiful code like that. [1] https://github.com/S-poony/Ultra-Square-Catcher-USC-/blob/ma...

But what if he wanted to turn it into a AAA FPS game with RTS elements in a persistent online world that supports millions of simultaneous users?

That was the next logical step during the early 2000s. Every bright-eyed college freshman on IRC was "recruiting" for his next awesome MMORPG idea.

Re: Show HN: I taught my little brother JS, and he made this videogame in a week

#217
post #69

Wow... Thought I was going to play for 10 maybe 15 seconds... I've never played a game for that long... This is seriously good. If you released this game without "little brother" I would think this was one of those amazing minimalist games. Thank you so much for making this!!

I don't understand, am I missing something? You just pick up blue and teal blocks while a red block slowly chases you? Why are people so excited about this? I feel like I'm missing something.

It's an interesting control scheme to get used to.

Re: Show HN: I taught my little brother JS, and he made this videogame in a week

#218

Look at the code guys [1]. I love it. This is simple. There is not a single line of bullshit. I hope he gonna become a great programmer and continue to make beautiful code like that. [1] https://github.com/S-poony/Ultra-Square-Catcher-USC-/blob/ma...

Really well done and I like the brevity. Here are some ideas for revising the code:

1. There are two functions called "distance" and they're identical. Only the outermost appears to be needed.

2. As written, the game places variable and function names into the global scope. It doesn't matter for this game, but will be a problem for larger games. One idea would be to use the Immediately Invoked Function Expression (IIFE) pattern [1]. Another would be to take advantage of ES6 modules[2] () to limit variable scope.

[1] https://developer.mozilla.org/en-US/docs/Glossary/IIFE

[2] https://www.contentful.com/blog/2017/04/04/es6-modules-suppo...

Re: Show HN: I taught my little brother JS, and he made this videogame in a week

#219

Earlier quoted context omitted.

The gyroscope is a datapoint that can be used for fingerprinting. Plus it gives quite a bit of information about you: whether you are lying down, sitting, walking, etc.

doesn't this assume the user is walking around with the page open, the front tab, and the phone unlocked for a reasonably long period? which websites do I spend enough time on for that to be true? I don't generally walk and read

Browsers now have service workers that run in the background even when the browser UI isn't loaded.

Re: Show HN: I taught my little brother JS, and he made this videogame in a week

#220

Earlier quoted context omitted.

That's a complaint about the JS language itself, that variables are global unless otherwise specified.

I do agree it’s a complaint about the language. However, I think it does ultimately fall on the developer to know how to work with the language including the bad/ugly/awful parts. I also think not polluting the global scope is a pretty foundational thing to know or be aware of. It’s really easy to shoot yourself in the foot or have naming collisions/overwrites happen if you aren’t careful. Another example would be me…

[deleted]
Post reply on HN