Hasn’t been mentioned before: try this on a phone. It uses the gyroscope for control and it quickly becomes second nature to balance/guide the square around the screen. Also a very nice and rewarding discovery process, as it starts out with squares speeding by, until you realize it’s the tilt of your phone that is causing it. Congrats, super fun!
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.
Good call. I'm impressed they implemented it that way. It's hard at first, but once I got used to the sensitivity, I found the mobile version of this game a lot easier to use than the desktop one.
Yeah, that was super cool. I'm a little annoyed that you can't lose (red block goes away under 10 points), but it was way more fun on my phone.
In fact, I didn't realize that the gyro worked in both dimensions! I thought it was just a fast downward fall and it was actually hard to hit the red block since it kept moving. Then I found out you could lay the phone flat and slow the green block down and it was way more fun!
I like the concept and could see a more complete game making a ton of sense.
I think it needs some sort of prompt about the tilting. Also the mechanism might need some calibration, I tested it with my SO and the tilting was too sensitive for her to control it accurately.
Nitpick: It's not just the gyroscope. DeviceOrientation (at least on the iPhone) uses blends both the accelerometer and gyroscope (and if specified, the compass too)
The APIs powering this are in the process of being heavily restricted or removed altogether -- if you think games like this should exist, you should voice your concern here: https://github.com/w3c/deviceorientation/issues/57.
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.
Agreed. There are so many JS projects these days composed of a dozen abstraction layers and barely-used libraries all mixed together and spread out across multiple files with an insanely complex "build system" on top, that it's very refreshing to see simple, self-contained JS.
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] (<script type="module">) to limit variable scope.
As far as logic goes, I totally agree, but personal preference nit pick, from a code writer and reader perspective, I think all subproperty access (`hero.acceleration.x`) could be cached to a variable, or just operate on plain variables and assign property access after mutations and only manipulate objects as needed.
It makes the code easier to write and read, IMHO, and I believe older engines had infinitesimal changes in performance with updating objects, so it's more of a habit and code clarity thing for me.
Of course, that's far less important than the fact that the logic is clear and concise, especially after learning JS in a week :)
Sure, with a duplicate distance function and one 100-line function? For me that in itself is horrible lol. But as a new programmer he should still be commended but bro, give credit only to where its due. And here its the fact that he's new, not that the code is "beautiful". (You're making me doubt what you think of beautiful code, but i guess since he's your brother you're definitely biased.)
This is... really impressive actually. Such a simple mechanic, but well executed. I like how the red block concept is introduced to you after the first few points are scored. The details of the implementation are really impressive for a first project, or even for a game project in general tbh.
Anyone noticed that you can click the game board to go full screen. This kid is doing more with less than many developers do with years of training. I think he's got a career in programming ahead.
That it?
Presume I use the arrow keys
OK, I pick up the other blocks..
Oh, I do like the inertia
and the smaller points give me more points
wakes up screaming at 3am as the red terminator block endlessly hunts me down
I found as the speed to the red block increased that sticking to the edge of the screen worked quite well to lure the red block away from where I wanted to be.
The red block reminds me of the monster in the film "It Follows". It very slowly but relentlessly heads straight for you wherever you are. Surprisingly unnerving.
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.
But looking at the source, the weird part is that it is half English, half French. It definitely doesn't look like the work of a single person.
I also looked at the commit history and I liked the teaching comments.
Clearly, there is a story behind that code. I suspect you did the first part together (moving square, ...) and that your brother played with it by himself later, adding the enemy, etc...
My code when i was kid was half english and half swedish, heck even today when i write simple "run once"-code they often have some swedish named variable.
Funny story from ~2005, a company developed a jvm for a special cpu and was aquired by a bigger company. After the aquasition 2 developers had to search the code base for two weeks after swedish swear words, they replaced them with the word of dandelion in swedish ("maskros").
What I want to say is that it is very common to mix english and ones native language.
Your game is faster paced, I like it. One issue I noticed is that the red blocks can spawn right in front of your block, making it nearly impossible to avoid. Rage quit inevitable.
Nice game, shortly after I started it dawned on me... Because it allows wrap-around you can just hold down the up arrow key and it becomes more of a 1-D game and seemed easier to play. Then the red thing showed up and started getting in the way and I found it easier to use all the arrows again.
So fun. I like the AI logic, if he wants a fun addition he should add more enemies as the score increases and implement something like the pac-man ghost logic so that they all behave differently: http://gameinternals.com/post/2072558330/understanding-pac-m...
Very nice. I had fun with it. Maybe a little description of the goals on the page underneath the play area would be good? Took me a while to realize picking up the red squares was actually reducing my score. I initially thought they were just meant to be more challenging to pick up since they moved.
Finally, one of these stories that didn't make me feel like an utterly talentless moron. This feels like what someone might be able to learn how to do in a week, but so often it seems like what you see here are 10 year olds writing real time ray tracing engines that use deep learning for some reason, and have source code that just happens to be a radiation hardened quine.
[+] [-] juretriglav|7 years ago|reply
[+] [-] crystalmace|7 years ago|reply
[+] [-] colordrops|7 years ago|reply
[+] [-] nkrisc|7 years ago|reply
[+] [-] anonytrary|7 years ago|reply
[+] [-] beatgammit|7 years ago|reply
In fact, I didn't realize that the gyro worked in both dimensions! I thought it was just a fast downward fall and it was actually hard to hit the red block since it kept moving. Then I found out you could lay the phone flat and slow the green block down and it was way more fun!
I like the concept and could see a more complete game making a ton of sense.
[+] [-] dom96|7 years ago|reply
I think it needs some sort of prompt about the tilting. Also the mechanism might need some calibration, I tested it with my SO and the tilting was too sensitive for her to control it accurately.
[+] [-] alphakappa|7 years ago|reply
[+] [-] komali2|7 years ago|reply
[+] [-] andyidsinga|7 years ago|reply
[+] [-] daliusd|7 years ago|reply
[+] [-] ronilan|7 years ago|reply
This is awosome on mobile!
[+] [-] KenanSulayman|7 years ago|reply
[+] [-] quadcore|7 years ago|reply
[1] https://github.com/S-poony/Ultra-Square-Catcher-USC-/blob/ma...
[+] [-] userbinator|7 years ago|reply
[+] [-] apo|7 years ago|reply
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] (<script type="module">) 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...
[+] [-] sbov|7 years ago|reply
[+] [-] finaliteration|7 years ago|reply
[+] [-] jeena|7 years ago|reply
Don't want to be the killjoy here but isn't line 77-79 the same as 85-87? With the rest I can agree.
[+] [-] 11235813213455|7 years ago|reply
[+] [-] HighSaysBob|7 years ago|reply
[+] [-] natecavanaugh|7 years ago|reply
[+] [-] Satsana|7 years ago|reply
[+] [-] carlosdp|7 years ago|reply
[+] [-] greenpizza13|7 years ago|reply
[+] [-] dwild|7 years ago|reply
That's not actually the impressive part of the code though so it remove nothing from him.
[+] [-] goldcd|7 years ago|reply
[+] [-] all2|7 years ago|reply
[+] [-] jpeanuts|7 years ago|reply
[+] [-] bduerst|7 years ago|reply
[+] [-] bbno4|7 years ago|reply
[+] [-] aerovistae|7 years ago|reply
[+] [-] GuB-42|7 years ago|reply
But looking at the source, the weird part is that it is half English, half French. It definitely doesn't look like the work of a single person.
I also looked at the commit history and I liked the teaching comments.
Clearly, there is a story behind that code. I suspect you did the first part together (moving square, ...) and that your brother played with it by himself later, adding the enemy, etc...
[+] [-] dosshell|7 years ago|reply
Funny story from ~2005, a company developed a jvm for a special cpu and was aquired by a bigger company. After the aquasition 2 developers had to search the code base for two weeks after swedish swear words, they replaced them with the word of dandelion in swedish ("maskros").
What I want to say is that it is very common to mix english and ones native language.
[+] [-] sandov|7 years ago|reply
[+] [-] baalimago|7 years ago|reply
To me it smells like karmafarming. How is everyone buying this? Where's your reasonable doubt?
[+] [-] OrBaruk|7 years ago|reply
https://orbaruk.github.io/
https://github.com/OrBaruk/squares-lgj
[+] [-] anonytrary|7 years ago|reply
[+] [-] unknown|7 years ago|reply
[deleted]
[+] [-] sonofgod|7 years ago|reply
The red block turning up later was AMAZING.
[+] [-] omni|7 years ago|reply
[+] [-] megaman8|7 years ago|reply
By the way, if you're interested in making your own tile based RPG game, I'm developing some tutorials to help you learn how: https://codeorc.com/learn-web-development-by-programming-a-r...
[+] [-] icholy|7 years ago|reply
[+] [-] kelvin0|7 years ago|reply
Watch out for the red block ... took me some time to realize it's a 'bad' block which subtracts from your score when touched.
[+] [-] automathematics|7 years ago|reply
[+] [-] phkahler|7 years ago|reply
[+] [-] maxmcd|7 years ago|reply
[+] [-] rcarmo|7 years ago|reply
[+] [-] cowpewter|7 years ago|reply
[+] [-] nsxwolf|7 years ago|reply