Welcome to the third of a multi-part series: 
Creating Animation and Games: Chapter 3 Lightcycles

This series will dive into using Propeller microcontroller based systems to create your own graphics, animation, and video games.  I'll assume that you only have a very basic knowledge of microcontroller programming and take you step-by-step from beginning with a single dot to the creation of several video games which will provide you great examples for getting started with your own ideas.

If you haven't read the previous chapters, go back and review them first with the links above then continue with this Chapter.

In the last chapters you learned how to interact with game controllers and many basic Spin programming concepts.   This time we are going to take everything we've learned so far and create one of my favorite games, the Lightcycles game from Tron.   Lightcycles is a fun two player game which will require two controllers (and two players) to play the game.

I recommend the game controller / keyboard combination used with the Pocket Mini Computer/VGAplus boards, but two keyboards plugged into the Human Interface Board (use the mouse jack for the second keyboard) will also work just fine.   Remember the MIGS controller driver object we discussed in the last chapter is pretty flexible.   Almost any combination of controllers will probably be adaptable to this chapter.

As before, let's go full throttle and start creating the Lightcycles game.

First download the source code for this Chapter and extract it to a new empty folder.   We'll be working from that folder. 

Step 1: Lightcycles: CON section

Open up the Propeller Tool again.   It's time to start creation of the Lightcycles game.

Start by typing the following eight lines:

Review: We are establishing settings which will remain CONstant throughout the operation of our program.

Be sure to choose the proper ColorMode.
(0 for standard vga color VGA, 1 for 256 color VGAplus256, TV can be either.)

Since we are using two controllers, set them to the starting I/O pins of the controllers you are planning to use:

Here are some examples:
  • Standard Propeller Demoboard, Human Interface Board, VGAplus or VGAplus256 keyboard = 26
  • Game controller on the VGAplus = 24
  • Game controller of the VGAplus256 = 26
  • Second Keyboard (using the mouse port) on the Human Interface Board = 24

It doesn't really matter which one is which.   MIGScontroller will be player 1, while MIGScontroller2 will be player 2.

Finally, right, left, up, down, and speed set some fixed variables required for the game itself.  
We'll talk about those later.

About This Instructable


13 favorites


More by Propellerpowered: Sprites & Graphics On the Micromite Companion Using the ESP8266 module Building your own Micromite Companion Minicomputer
Add instructable to: