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…
Show HN: I taught my little brother JS, and he made this videogame in a week
211–220 of 285 posts
Re: Show HN: I taught my little brother JS, and he made this videogame in a week
#212Earlier 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.
Re: Show HN: I taught my little brother JS, and he made this videogame in a week
#213Re: Show HN: I taught my little brother JS, and he made this videogame in a week
#214Earlier 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.
Re: Show HN: I taught my little brother JS, and he made this videogame in a week
#215Earlier 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"
Re: Show HN: I taught my little brother JS, and he made this videogame in a week
#216Look 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?
Re: Show HN: I taught my little brother JS, and he made this videogame in a week
#217Wow... 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.
Re: Show HN: I taught my little brother JS, and he made this videogame in a week
#218Look 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...
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
#219Earlier 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
Re: Show HN: I taught my little brother JS, and he made this videogame in a week
#220Earlier 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…