Space invaders with a nRF2401A wireless joypad

Dependencies:   Gameduino mbed nRF2401A

Fork of Gameduino_Invaders_game by Chris Dick

Gameduino and an nRF2401A hooked up to an mbed on an mbeduino:

/media/uploads/TheChrisyd/2014-03-08_22.53.54.jpg

main.cpp

Committer:
TheChrisyd
Date:
2012-09-29
Revision:
1:f44175dd69fd
Parent:
0:8a7c58553b44
Child:
2:20a89dc286d5

File content as of revision 1:f44175dd69fd:

#include "mbed.h"
#include "GD.h"


/*---------------------------------------------------------
  A Space Invaders clone for Gameduino

  http://www.artlum.com/gameduino/gameduino.html#invaders

  Version 0.9 alpha - Still seme things to add
  but I'm out of memory!

  Edit "joystick.cpp" if you have a custom joystick.
---------------------------------------------------------*/

#include <SPI.h>
#include <GD.h>
#include "game.h"
#include "arduino.h"

void setup() {
    GD.begin();
    makeGraphics();
    Coprocessor::reset(samplePlaybackBuffer);
    randomSeed(GD.rd(FRAME));
    resetGameSounds();
    initGame();
}

void loop() {
    GD.waitvblank();
    updateGame();
    updateGameSounds();

    // Debugging/info
    if (0) {
        joystick.dump(0,33);   // Show the joystick state
        int yline = Coprocessor::yline();
        showNumber(yline,0,31);
    }
    // Screenshot when you press the select button
    if (0 and joystick.isPressed(Joystick::buttonSelect)) {
        sendScreenshot();
    }
}


int main() {
    setup();
    while (1) {
        loop();
    }
}