Re:My son (9 yrs old) used plain JavaScript to make a game, ...
by WesleyJohnson on Tuesday December 03, 2024 @07:23PM
(#42313267)
Agree 100%. Since dad helped, I was expecting to see sprites sheets, or some JS classes for some OOP, etc. Was pleasantly surprised to see how "simple" the approach was for such fun output with a decent amount of variety.
Re:My son (9 yrs old) used plain JavaScript to make a game, ...
by veesahni on Tuesday December 03, 2024 @08:01PM
(#42313488)
He doesn't understand what a sprite is, or really the motivation behind sprite sheets. To him they're just animated images he made in a tool. Internally he switches the "costumes" of characters (terminology he got from Scratch I believe).
Re:My son (9 yrs old) used plain JavaScript to make a game, ...
by WesleyJohnson on Tuesday December 03, 2024 @08:15PM
(#42313577)
That's so great. So many software engineers (myself included) tend to overcomplicate things.
Re:My son (9 yrs old) used plain JavaScript to make a game, ...
by wkyleg on Tuesday December 03, 2024 @07:34PM
(#42313330)
This is how cool new ideas arrive each generation
I would recommend a couple of small things for the code. Variable names are usually ALL_CAPS if they never change (for instance const PI =3.142) and camelCaseForOtherVariables. snake_case_variables aren't really used in JavaScript, but aren't technically wrong. Also, it's usually good to put variables into nested data structures with hashmaps instead of comparing based upon array index. This is in "the real world" though, in academic computer science algorithms based on position in lists are more common.
If you want to get what we call "Code Review" a good way would be to feed your source code into a LLM to have the LLM give feedback based on your code, and recommend improvements. Most people like Claude best for dealing with code nowadays.
I would also recommend putting your code on Github so that people can check it out.
Very impressive!