For execution on a SolderCore and a SolderCore Arcade Shield or SolderCore LCD Shield. I've even run this code on a Windows PC using Qt to do GUI heavy lifting.
This code replicates, as accurately as I can make it, a Williams Defender unit. Defender was one of those games that was pretty awesome for its time.
Please don't complain about the coding style, don't ask how it works, just do not bother me. I send this code out into the world to fend for itself and for you to unravel any puzzles you find. You have a SolderCore, you have an Arcade Shield, you have CrossWorks, you have a debugger, so all is not lost.
This code is primarily intended to run on a SolderCore and a SolderCore Arcade Shield or a SolderCore LCD Shield. Best gameplay comes from using the Arcade Shield because the display is bigger and it is considerably faster.
You can also run this code, using a SolderCore Arcade Shield or SolderCore LCD Shield, on:
And you can run this code using the integrated LCD of:
...and perhaps this code is included in CrossStudio as an Easter Egg? :-)
The code can either use a Defender Playboard with a standard joystick and arcade buttons or a Nintendo Wii Classic Controller.
You can attach a Classic Controller using a SolderCore SenseCore and WiiChuk adapter. I happen to lay everything out using a 2x2 "flat four" base.
I've also coded up an interface using the Nintendo Wii Nunchuk Controller for the STM32-LCD in case you purchased one of those from Olimex. In this case, use the analog joystick for ship control and C to let off a smart bomb and Z to fire.
I laser-cut my Defender Playboard from 5mm acrylic and fitted some proper arcade buttons and a nice joystick. A good place to purchase these in the UK is Gremlin Solutions. You will find that 3mm acrylic is a better fit for the arcade buttons from Gremlin because they have a spring-latch underneath that will not lock on 5mm acrylic—I rebated the cuts for the buttons so mine would.
A warning: I purchased some arcade buttons from SparkFun but these are very deep and have a seriously naff feel. Don't use these arcade buttons, they are truly awful.
I took a little artistic license with the gameplay:
Some things have not been implemented yet, and I may well get round to implementing them when I feel the need. Things left out for the moment are: