Mon Jan 19, 2015 1:55 pm
#include <Backlight.h>
#include <Battery.h>
#include <Buttons.h>
#include <Display.h>
#include <Gamebuino.h>
#include <Sound.h>
#include <SPI.h>
Gamebuino gb;
int trainer_x = LCDWIDTH/2;
int trainer_y = LCDHEIGHT/2;
int trainer_vx = 2;
int trainer_vy = 2;
int trainer_inv = 6;
const byte PROGMEM trainerup[] =
{
16,16,
B111111111111111,
B111111111111111,
B111111111111111,
B111111111111111,
B111111111111111,
B111111111111111,
B000000000000000,
B000000000000000,
B000000000000000,
B000000000000000,
B000000000000000,
B000000000000000,
B000000000000000,
B000000000000000,
B000000000000000,
B000000000000000,
};
const byte PROGMEM trainerdown[] =
{
16,16,
B0000000000000000,
B0000000000000000,
B0000000000000000,
B0000000000000000,
B0000000000000000,
B0000000000000000,
B0000000000000000,
B0000000000000000,
B0000000000000000,
B0000000000000000,
B1111111111111111,
B1111111111111111,
B1111111111111111,
B1111111111111111,
B1111111111111111,
B1111111111111111,
};
void setup(){
// put your setup code here, to run once:
gb.begin();
gb.titleScreen(F("PokeMon"));
}
void loop(){
// put your main code here, to run repeatedly:
if(gb.update()){
//HIER STEURERRUNG
if(gb.buttons.repeat(BTN_LEFT,1)){
trainer_x = trainer_x - trainer_vx;
}
if(gb.buttons.repeat(BTN_RIGHT,1)){
trainer_x = trainer_x + trainer_vx;
}
if(gb.buttons.repeat(BTN_UP,1)){
trainer_y = trainer_y - trainer_vy;
gb.display.drawBitmap(trainer_x,trainer_y,trainerup);
}
if(gb.buttons.repeat(BTN_DOWN,1)){
trainer_y = trainer_y + trainer_vy;
gb.display.drawBitmap(trainer_x,trainer_y,trainerdown);
}
if(trainer_x < 0){
trainer_x = 0;
}
if((trainer_x + 7) > LCDWIDTH){
trainer_x = LCDWIDTH - 7;
}
if(trainer_y < 0){
trainer_y = 0;
}
if((trainer_y + 8) > LCDHEIGHT){
trainer_y = LCDHEIGHT - 8;
}
//HIER POKE INVENTAR
}
}
Tue Jan 20, 2015 2:22 pm
Tue Jan 20, 2015 6:51 pm
const byte Bild1[] PROGMEM = {16,16,
B00000000,B00000000,
B00000000,B00000000,
B00000100,B01000000,
B00000100,B01000000,
B00000100,B01000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00010000,B00110000,
B00011000,B01100000,
B00001111,B10000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
};
Wed Jan 21, 2015 5:05 pm
if(gb.buttons.pressed(BTN_C)){
gb.titleScreen(F("PokeMon"));
}
if(gb.buttons.repeat(BTN_LEFT,1)){
trainer_x = trainer_x - trainer_vx;
gb.display.drawBitmap(trainer_x,trainer_y,trainerleft);
}
if(gb.buttons.repeat(BTN_RIGHT,1)){
trainer_x = trainer_x + trainer_vx;
gb.display.drawBitmap(trainer_x,trainer_y,trainerright);
}
if(gb.buttons.repeat(BTN_UP,1)){
trainer_y = trainer_y - trainer_vy;
gb.display.drawBitmap(trainer_x,trainer_y,trainerup);
}
if(gb.buttons.repeat(BTN_DOWN,1)){
trainer_y = trainer_y + trainer_vy;
gb.display.drawBitmap(trainer_x,trainer_y,trainerdown);
}
Wed Jan 21, 2015 5:27 pm
Wed Jan 21, 2015 7:19 pm