Version of Robotron arcade game using LPC1768, a Gameduino shield, a serial EEPROM (for high scores), two microswitch joysticks and two buttons plus a box to put it in. 20 levels of mayhem.

Dependencies:   25LCxxx_SPI CommonTypes Gameduino mbed

Revision:
8:82d88f9381f3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BlueMeanyObject.cpp	Sat Jun 08 17:51:33 2013 +0000
@@ -0,0 +1,43 @@
+/*
+ * SOURCE FILE : BlueMeanyObject.cpp
+ *
+ * Represents the BlueMeany enemy object.
+ *
+ */
+
+#include "BlueMeanyObject.h"
+#include "MathFuncs.h"
+
+/************************/
+/* MOVE THE GAME OBJECT */
+/************************/
+void BlueMeanyObject::ProtectedMove( void ) {
+  // If being restricted horizontally then make horizontal velocity zero.
+  if( RestrictionFlags & ( LeftRestriction | RightRestriction ) ) {
+    hVelocity = 0;
+  }
+  // If being restricted vertically then make vertical velocity zero.
+  if( RestrictionFlags & ( UpRestriction | DownRestriction ) ) {
+    vVelocity = 0;
+  }
+  // Update coordinates by adding velocities.
+  Xco += hVelocity;
+  Yco += vVelocity;
+  // Accelerate towards chase object horizontally.
+  if( Xco > chaseObject->Xco ) {
+    hVelocity--;
+  }
+  else {
+    hVelocity++;
+  }
+  // Accelerate towards chase object vertically.
+  if( Yco > chaseObject->Yco ) {
+    vVelocity--;
+  }
+  else {
+    vVelocity++;
+  }
+  // Don't let speed get too fast.
+  hVelocity = MathFuncs::Constrain( hVelocity, -MaxBlueMeanyVelocity, MaxBlueMeanyVelocity );
+  vVelocity = MathFuncs::Constrain( vVelocity, -MaxBlueMeanyVelocity, MaxBlueMeanyVelocity );
+}