Please criticize this rhythm game I made

Press the arrow keys at the right time for the best score. The more accurate you are, the more points you get. Any criticism is appreciated

maybe make the topic name more descriptive about what the project is about?

First, from a gameplay perspective, this is very good. The timing of pressing the arrow keys is generous but not TOO generous, and the speed is just about right: fast enough to keep you on your toes, but not so fast that it’s frustrating. Well done.

One improvement to gameplay might be to penalize the player for pressing the arrow keys when a note is NOT falling, or perhaps when it’s falling but too far away. Otherwise it’s pretty easy to just mash the arrow keys all the time, and although you won’t get a “Wonderful!” score, you’ll never miss a falling arrow.

Now for looking at your code. You did an excellent job of splitting your script across different sprites and using broadcast to tell them when to run their scripts. Again, well done. And I was impressed by your custom “space out sprites” blocks:custom-space-block

second-custom-block

Excellent job of taking a complex task and turning it into a custom block. Good names, easy to read, hides away the complexity so that the top-level script is easy to read. Yet another “well done!” here.

I did notice one place where you could create a custom block but you didn’t. The following code, with just minor variations, is repeated in all four arrows:

That could easily be turned into a custom block. Making this a custom block would have at least two advantages:

  1. The top-level code for each arrow would be easier to read.
  2. If you wanted to change the numbers 8, 21, and 61, you could change it in just one place (inside the custom block) and it would be automatically changed for all four arrows. As it currently stands, if you decided that 61 was too generous and you wanted to change it to 41 instead, you would have to make that change in four places, and you’d risk changing it in just three places and forgetting the fourth one.

Another place where a custom block would help you is this calculation:

my-center

You could create a custom block called “my center” or “my Y center” with that content, and make your “is the clone close to the parent” logic easier to read.

And another block that’s repeated often is this one:

Once you create a few custom blocks for the places where you have repeated code, the code becomes a lot easier to read. Observe:

And now the entire left arrow logic looks like this:

I can read that in one go, and understand exactly what it’s doing. When the “abs of ask my parent for my bottom + my top - my bottom / 2, etc” block was repeated, it was a lot harder to look at the left-arrow logic and be certain that it was correct.

And that brings us back to the first thing I mentioned, about the top-level logic being easier to read. Easier to read also means easier to spot mistakes. If one of those “61” values was “51” by mistake, it would be easy to miss it in the complex, repeated-code version. But by defining two custom blocks, the numbers stand out much better and it’s a lot easier to verify that you’ve gotten the numbers right everywhere.

I have one more thing to say, but this comment is already super long, so I’ll give you my next piece of feedback in a different comment.

The last thing I want to say is about this block:

I omitted the repeated part inside the ring (which, by the way, could also be a custom block: any time you have repeated code, that’s a clue that a custom block is probably a good idea) so that I could focus on the logic. It looks to me like what you’re trying to do is “at random, pick one arrow, left/right/up/down, and send that arrow a message to make it start falling”.

But that’s not what’s actually happening. Try playing your game for a few minutes, and pay attention to how often you see the arrows. You might notice that UP arrows show up most often, then DOWN arrows show up almost as often, but LEFT arrows don’t show up quite as often as UP or DOWN, and RIGHT arrows are the least likely to appear. Can you guess why that is?

I’ll give you another clue. The chances of each arrow appearing in your game are as follows:

UP: 1/4 chance (25%) of appearing
DOWN: 3/4 × 1/4 = 3/16 (18.75%) chance of appearing
LEFT: 3/4 × 3/4 × 1/4 = 9/64 (14.0625%) chance of appearing
RIGHT: 3/4 × 3/4 × 3/4 × 1/4 = 27/256 (10.546875%) chance of appearing.

If you’ve figured out why this is happening, good job! If you want the answer, then click the blurred spoiler text below to find out what’s going on:

Each time you run the “pick random 1 to 4” block, it chooses a different random number, like rolling a 4-sided die again. So if the first die roll is 1, then UP shows up, a 1/4 chance. If the first die roll is NOT 1 (a 3/4 chance), then and only then will the die be rolled again to choose DOWN. If the second die roll is 2 (a 1/4 chance), then DOWN will be chosen, but that can only happen if the first die roll was not 1 (a 3/4 chance). So for DOWN to be chosen, you have to have a 3/4 chance happen AND then a 1/4 chance happen, meaning its odds are actually 3/4 × 1/4 = 3/16. And so on for LEFT and RIGHT.

What you probably wanted was to use a script variable called “chosen arrow”, set it to the result of “pick random 1 to 4” just once, and then do “if chosen arrow = 1, else if chosen arrow = 2, else if chosen arrow = 3” and so on. Then you are rolling the 4-sided die just ONCE, and each of UP/DOWN/LEFT/RIGHT will have equal chances of appearing.

Spoilers below for how I suggest fixing that issue:

First, a custom block to get rid of repeated code:

Then fixing the “pick random 1 to 4” logic:

With those two fixes, the arrows show up a LOT more often (because every time you go through the if block it guarantees an arrow, whereas before there was a 3/4 × 3/4 × 3/4 × 3/4 = 81/256 (31.640625%) chance that no arrows would show up each time through the loop. This turns the game from “easy, I can let my attention drift away while playing” to “wow, this is fast-paced and challenging, I have to stay on my toes if I want to win”. Which is exactly what you want in a rhythm game.

I am adding this

Thank you so much for the detailed feedback, this is exactly what I was looking for

This is a nice rhythm game! (it took me a minute to correctly spell rhythm)

I would suggest making the arrows faster every time you successfully time the key press, and if it does already, I would suggest making it a little faster.

I would also suggest making the arrows slightly faster when you are in a wonderful streak, making it slightly harder to maintain the streak.

Lastly, I would suggest adding some sort of indicator when you are pressing a key (making the arrows change color, making them change size, etc.)

You’re welcome; glad I could help.

If you don’t mind my asking, are you in high school? Or college? Or something else and I’ve completely guessed wrong about your age? (Note that I’m NOT asking your age — you should never tell strangers on the Internet such things as your birthday, or even your birth year; you’ll notice that my own profile just lists my age as “between 40 and 60”).

I ask this because although I could see some beginner’s mistakes in your programming, there weren’t very many beginner’s mistakes; a lot fewer than I was making at your age (if I’m guessing right about how old you are). And you seem to have a solid grasp on the fundamentals. I have a feeling that by the time you’re looking for a job in programming, you’re going to be someone that I would want to hire. If, that is, my employer will be hiring anyone at that point, which is something you can never guarantee years, or even months, in advance given how economies and the job market shift around.

But the point is, I’m impressed with the programming skills you’ve shown thus far, and I’ll be happy to help review any other code you want to show off to people.

Thanks, id like to be a programmer someday so ill check back here if things get there

By the time you’re at a point where you’re looking for a job, there will probably be other forums that are better places to find jobs, and/or I might not be reading the Snap! forum quite as often any more. (Some of the forums I used to read 5-10 years ago no longer exist, others I’ve drifted away from). But if you see someone with the username rmunn on some other forum with the same avatar of a robin, then it’s probably me, so feel free to say hi. (And remind me that you’re the guy who made that rhythm game in Snap! if you have a different username and I don’t recognize you).