Race around the city collecting the flags while avoiding those that stand in the way of your mission. Make no mistake you will need to be quick to outwit your opponents, they are smart and will try to box you in. I wrote this game to prove that writing a game with scrolling scenery is possible even with the limited 6kB of RAM available. I had to compromise sound effects for features, I wanted multiple opponents, I wanted to be able to drop smoke bombs to trap the opponents but all this required memory so the sound effects had to take a back seat.

Dependencies:   mbed

Committer:
taylorza
Date:
Sun Feb 01 00:43:25 2015 +0000
Revision:
1:1b8125937f28
Minor updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
taylorza 1:1b8125937f28 1 #include "Beeper.h"
taylorza 1:1b8125937f28 2
taylorza 1:1b8125937f28 3 DigitalOut Beeper::_speaker(P0_18);
taylorza 1:1b8125937f28 4
taylorza 1:1b8125937f28 5 void Beeper::beep(int freq, int ms)
taylorza 1:1b8125937f28 6 {
taylorza 1:1b8125937f28 7 float delay = 1.0f / (float)freq;
taylorza 1:1b8125937f28 8 float duration = (float)ms / 1000.0f;
taylorza 1:1b8125937f28 9 while (duration > 0)
taylorza 1:1b8125937f28 10 {
taylorza 1:1b8125937f28 11 _speaker = !_speaker;
taylorza 1:1b8125937f28 12 wait(delay);
taylorza 1:1b8125937f28 13 duration -= delay;
taylorza 1:1b8125937f28 14 }
taylorza 1:1b8125937f28 15 }
taylorza 1:1b8125937f28 16
taylorza 1:1b8125937f28 17 void Beeper::noise(int freq, int ms)
taylorza 1:1b8125937f28 18 {
taylorza 1:1b8125937f28 19 float delay = 1.0f / (float)freq;
taylorza 1:1b8125937f28 20 float duration = (float)ms / 1000.0f;
taylorza 1:1b8125937f28 21 while (duration > 0)
taylorza 1:1b8125937f28 22 {
taylorza 1:1b8125937f28 23 _speaker = lfsr_rand() & 0x01;
taylorza 1:1b8125937f28 24 wait(delay);
taylorza 1:1b8125937f28 25 duration -= delay;
taylorza 1:1b8125937f28 26 }
taylorza 1:1b8125937f28 27 }