Planetary Intruders - A remix of Space Invaders

Download

PI1 PI2 PI3

9 Likes

You would probably be able to gain quite a bit of memory by switching from using the (no longer maintained) Arduboy library to the Arduboy2 library.

2 Likes

Looks good … and I love it when the aliens go nuts.

The sounds are really effective.

My only criticism is the use of the B-Button to select options - I find myself always pressing the ‘A’ button.

1 Like

Out of interest, was this a port of a version from a different console or something?

I’ve genuinely never seen anyone do stuff like this before:

#define LOAD ard.display()
#define CLEAR ard.clearDisplay()

https://www.ioccc.org/
:face_with_raised_eyebrow:

It’s also rare to see capitalization of the first character of variables and function names, usually reserved for constants or enumerations. I found it a bit confusing.

I’ve seen code bases that use Pascal casing for functions.
C# in particular has popularised Pascal case and that’s carried across into some C++ pools.
I agree it’s somewhat uncommon though.


Makes sense.

Laziness is a virtue.

Though I think it harms readaiblity here.
You’d have been better off writing a forwarding function.
e.g.

void display()
{
#if (defined(ARDUBOY_10) || defined(AB_DEVKIT))
  ard.display();
#else
  oled.display();
#end
}

Or at least made the names match (DISPLAY would have made more sense than LOAD).

1 Like

I don’t even have to write code ironically to win the IOCCC… yay…
Guess I’ve got to drop the habit of putting capital letters for names of variables and functions in that case.
…and I’ve said “I also want to allow people to modify the game if they want”. Maybe I should have learned to actually write code clearly before saying that. XD

To be honest the casing is less of an issue than the #define LOAD ard.display() stuff. The casing is slightly unusual, but overall doesn’t have much of an impact beyond the initial “oh, pascal casing, unexpected but fair enough”, so if you don’t want to have to go through and change all those then I think your code would still be readable. (TL;DR: If you do want to change them, fair enough, if you can’t be bothered, fair enough.)

On the other hand the use of the #defines on the functions and the mismatched names (e.g. LOAD and .display()) are a readability issue - they make the code harder to understand.
So if you want to ‘clean it up’, I’d recommend focusing on those first. If you want to keep it portable between the two systems then you could use the approach I showed earlier (void display()).