If someone like to help me, i need some graphics.
Frog, Cars, etc....
First test code with no output.
- Code: Select all
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//importe the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
// Game constants
boolean paused = false;
//Game Speed
unsigned long prevTime = 0; // for gamedelay (ms)
int delayTime = 500; // Game step in ms
typedef struct
{
char x;
char y;
byte w;
byte h;
} player;
player Frogg;
typedef struct
{
char x;
char y;
byte w;
byte h;
} enemy;
void setup() {
// initialize the Gamebuino object
gb.begin();
gb.startMenu(F("Frogger by Ripper121"));
initGame();
}
void loop(void)
{
if (gb.update()) {
if (gb.buttons.pressed(BTN_C)) {
paused = !paused; //toggle paused state
}
if (!paused) {
if (gb.buttons.pressed(BTN_LEFT)) {
}
if (gb.buttons.pressed(BTN_RIGHT)) {
}
if (gb.buttons.pressed(BTN_UP)) {
}
if (gb.buttons.pressed(BTN_DOWN)) {
}
unsigned long currentTime = millis();
if (currentTime - prevTime >= delayTime) {
nextstep();
prevTime = currentTime;
}
}
draw();
}
}
void initGame() {
//Game Speed
prevTime = 0; // for gamedelay (ms)
delayTime = 200; // Game step in ms
randomSeed(millis());
}
void draw() {
gb.display.drawFastVLine(0, 0, LCDHEIGHT);
gb.display.drawFastHLine(0, 0, LCDWIDTH);
gb.display.drawFastVLine(LCDWIDTH-1, 0, LCDHEIGHT);
gb.display.drawFastHLine(0, LCDHEIGHT-1, LCDWIDTH);
}
void nextstep() {}