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

261–270 of 285 posts

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

#261
post #218

Earlier quoted context omitted.

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 (II…

Also never use Math.pow for squaring numbers (used in the distance function) because it is significantly slower as it is designed for abitrary real exponents, not just integer ones. Cannot be learned soon enough IMO :) Still a very good job for just a week of coding though.

This advice is incorrect. Experimenting in the console in both Firefox and Chrome shows that there's not a significant speed difference between the two, even if you make sure you only call a given function with integers <10000.

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

#263

how little is little? why didnt he post it here himself? feels a little suspect.

Maybe because he is not on hackernews? I told him I did this post, and he reads your comments, though. He is 15. I should have written younger brother and not little brother; english is not my native language.

If he truly did it, that's great and seems like you guys could start an indie studio and work part time on upwork or something until you get funded.

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

#264

Earlier quoted context omitted.

Also never use Math.pow for squaring numbers (used in the distance function) because it is significantly slower as it is designed for abitrary real exponents, not just integer ones. Cannot be learned soon enough IMO :) Still a very good job for just a week of coding though.

This advice is incorrect. Experimenting in the console in both Firefox and Chrome shows that there's not a significant speed difference between the two, even if you make sure you only call a given function with integers <10000.

On my laptop it is about 30% slower (tested with Firefox 64). However I agree, this was not very good advice for someone who just started programming with JS...

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

#265
post #77

I love that the red block doesn't understand the concept of wrapping. It reminds me of playing with my dog.

I was actually going to ask what the rationale behind this was. I found that because of this, the best strategy was usually to wrap around to distract the block. I personally felt like the game would have worked better without that, although hard to know without trying it.

Could simply be that ignoring the wraparound is the naïve way to provide a direction for the red dot. Navigating a wraparound world is also unintuitive, so the player would be at a disadvantage if the enemy could take advantage.

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

#267

Earlier quoted context omitted.

Or your Macbook Pro if it originally came with an HDD. Apparently the device orientation API can utilize the triaxial accelerometer that Apple used for drop detection. Really neat experience tilting my laptop around like a mad man.

Can confirm that HP Probooks had the same accelerometer in 2011-2014. Win8 used it for screen orientation OOTB.

pioneered I believe by ThinkPads in 2003 http://www.thinkwiki.org/wiki/Active_Protection_System

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

#268
post #221

Earlier quoted context omitted.

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…

> However, I think it does ultimately fall on the developer to know... This person has been programming for a week. I think we can let this slide

I’m not at all saying they should be an expert after a week. But learning those things is part of being a software developer/programmer and I don’t think, “Well the language sucks” is a valid argument.

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

#269
post #186
post #176

Earlier quoted context omitted.

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?

If you're not joking and actually making that statement seriously you need to close your computer and go take a few hour walk.

[deleted]

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

#270
this is awesome, and very similar to what got me into dev.

when I was 11 an online friend showed me a "game" he was working on using VB6. There was a little star you moved across the screen by clicking buttons for u/d/l/r. His end goal was a top-down RPG.

Seeing projects like this always hold a special place in my heart. Best of luck to your brother. I hope his passion grows and he does amazing things

Post reply on HN