Sat Jul 30, 2016 10:04 pm
#include <SPI.h>
#include <Gamebuino.h>
Gamebuino gb;
const byte logo[] = {88,48,
0xfe,0xef,0x7f,0xff,0xff,0xff,0xff,0xff,0xef,0xdf,0xf0
,0xf6,0xdf,0xbf,0xff,0xff,0xff,0xff,0xff,0xdf,0xff,0x70
,0xf7,0xbb,0xbf,0xff,0xff,0xff,0xff,0xff,0xdd,0xef,0xf0
,0xef,0x77,0x71,0x51,0xdd,0x74,0x57,0xfc,0xee,0xf7,0x70
,0xfe,0xfe,0xfb,0x57,0xc9,0x26,0xd7,0xfb,0xf7,0x7f,0xb0
,0x7d,0xbe,0xfb,0x13,0xd5,0xde,0xc7,0x89,0xf6,0xf7,0x70
,0xb3,0xdd,0xfb,0x57,0xdd,0xde,0xd7,0xab,0xfb,0xeb,0xf0
,0xcf,0xf7,0xfb,0x51,0xdd,0xde,0xd7,0x8b,0xfc,0xbd,0xe0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x10
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0x8f,0x03,0x88,0xe1,0xc1,0xc3,0xbf,0x0f,0x9f,0xf0
,0xff,0xb6,0xfd,0x77,0x5e,0xbe,0xbd,0x5e,0xf7,0x6f,0xf0
,0xff,0x6d,0xe1,0x7f,0x51,0xa2,0xa3,0x5e,0xfa,0xf7,0xf0
,0xfe,0xdd,0xdf,0x7f,0x57,0xa2,0xaf,0x5e,0x8a,0x97,0xf0
,0xfe,0xbd,0xdf,0x7f,0x57,0xbe,0xaf,0x5e,0xaa,0x9b,0xf0
,0xfd,0x8d,0xc3,0x49,0x51,0xbd,0xa3,0x5e,0xaa,0xfb,0xf0
,0xfb,0xf5,0xfd,0x55,0x5e,0xbb,0xbd,0x5e,0xaa,0xdb,0xf0
,0xfb,0x0e,0x3d,0x5d,0x59,0xbd,0xb3,0x5e,0xaa,0xad,0xf0
,0xf6,0x7f,0xdd,0x5d,0x57,0xb6,0xaf,0x5e,0xaa,0xb5,0xf0
,0xf5,0xff,0xdd,0x5d,0x57,0xaa,0xaf,0x5e,0x8a,0xb6,0xf0
,0xec,0x0c,0x1d,0x5d,0x51,0xaa,0xa3,0x46,0xfa,0xba,0xf0
,0xef,0xf5,0xfb,0x5d,0x5e,0xaa,0xbd,0x7a,0xf6,0xbb,0x70
,0xe0,0x0e,0x07,0x9e,0x61,0x88,0xc3,0x87,0x0f,0x7c,0x70
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0
,0xff,0xff,0xff,0x39,0x8c,0xe7,0xff,0x7f,0xff,0xff,0xf0
,0x7b,0xff,0xfe,0xd6,0xbb,0x5b,0xfe,0xbf,0xff,0xfd,0xe0
,0xa7,0xff,0xfe,0xd6,0x8d,0xef,0xfe,0xbf,0xff,0xfe,0x90
,0xa6,0x9f,0xfe,0x31,0xbe,0xf7,0xfe,0x3f,0xff,0xa6,0x90
,0x59,0x6f,0xfe,0xf5,0xbb,0x5b,0xfe,0xbf,0xff,0x59,0x60
,0xeb,0xaf,0xfe,0xf6,0x8c,0xe7,0xfe,0xbf,0xff,0xeb,0xa0
,0x5d,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5d,0x70
,0x79,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x79,0xe0
,0xa6,0x9f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa6,0x90
,0xa6,0x9a,0x69,0xff,0xff,0xe9,0xa6,0x9a,0x69,0xa6,0x90
,0x59,0x65,0x96,0xff,0xff,0xd6,0x59,0x65,0x96,0x59,0x60
,0xeb,0xae,0xba,0xff,0xff,0xfa,0xeb,0xae,0xba,0xeb,0xa0
,0x5d,0x75,0xd7,0x55,0x55,0x57,0x5d,0x75,0xd7,0x5d,0x70
,0x79,0xe7,0x9e,0xaa,0xaa,0x9e,0x79,0xe7,0x9e,0x79,0xe0
,0xa6,0x9a,0x69,0xff,0xff,0xe9,0xa6,0x9a,0x69,0xa6,0x90
,0xa6,0x9a,0x69,0xaa,0xaa,0xa9,0xa6,0x9a,0x69,0xa6,0x90
,0x59,0x65,0x97,0x55,0x55,0x56,0x59,0x65,0x96,0x59,0x60
,0xeb,0xae,0xba,0x7f,0xff,0xfa,0xeb,0xae,0xba,0xeb,0xa0
,0x5d,0x75,0xd7,0xaa,0xaa,0x97,0x5d,0x75,0xd7,0x5d,0x70
,0x79,0xe7,0x9e,0x55,0x55,0x5e,0x79,0xe7,0x9e,0x79,0xe0
,0xa6,0x9a,0x69,0x7f,0xff,0xe9,0xa6,0x9a,0x69,0xa6,0x90,};
const byte PROGMEM room_1[] = {88,48,
0x59,0x65,0x96,0x59,0x60,0x00,0x59,0x65,0x96,0x59,0x60
,0xa6,0x9a,0x69,0xa6,0x90,0x00,0xa6,0x9a,0x69,0xa6,0x90
,0x14,0x51,0x45,0x14,0x50,0x00,0x14,0x51,0x45,0x14,0x50
,0xa2,0x8a,0x28,0xa2,0x80,0x00,0xa2,0x8a,0x28,0xa2,0x80
,0x86,0x18,0x61,0x86,0x10,0x00,0x86,0x18,0x61,0x86,0x10
,0x59,0x65,0x96,0x59,0x60,0x00,0x59,0x65,0x96,0x59,0x60
,0x59,0x65,0x80,0x58,0x00,0x00,0x00,0x00,0x00,0x59,0x60
,0xa6,0x9a,0x40,0xa4,0x00,0x00,0x00,0x00,0x00,0xa6,0x90
,0x14,0x51,0x40,0x14,0x00,0x00,0x00,0x00,0x00,0x14,0x50
,0xa2,0x8a,0x00,0xa0,0x00,0x00,0x00,0x00,0x00,0xa2,0x80
,0x86,0x18,0x40,0x84,0x00,0x00,0x00,0x00,0x00,0x86,0x10
,0x59,0x65,0x80,0x58,0x00,0x00,0x00,0x00,0x00,0x59,0x60
,0x59,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x60
,0xa6,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa6,0x90
,0x14,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x50
,0xa2,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa2,0x80
,0x86,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x86,0x10
,0x59,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x60
,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x60
,0xa4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa6,0x90
,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x50
,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa2,0x80
,0x84,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x86,0x10
,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x60
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x59,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x60
,0xa6,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa6,0x90
,0x14,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x50
,0xa2,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa2,0x80
,0x86,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x86,0x10
,0x59,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x60
,0x59,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x60
,0xa6,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa6,0x90
,0x14,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x50
,0xa2,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa2,0x80
,0x86,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x86,0x10
,0x59,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x60
,0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x60
,0xa6,0x9a,0x69,0xa6,0x9a,0x69,0xa6,0x9a,0x69,0xa6,0x90
,0x14,0x51,0x45,0x14,0x51,0x45,0x14,0x51,0x45,0x14,0x50
,0xa2,0x8a,0x28,0xa2,0x8a,0x28,0xa2,0x8a,0x28,0xa2,0x80
,0x86,0x18,0x61,0x86,0x18,0x61,0x86,0x18,0x61,0x86,0x10
,0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x65,0x96,0x59,0x60,};
const byte sever_front[] PROGMEM = {6,6,
B111111,
B010010,
B011110,
B101101,
B011110,
B110011,};
void setup() {
// put your setup code here, to run once:
gb.begin();
gb.titleScreen(F("Myth of esmerelda"));
}
void loop() {
// put your main code here, to run repeatedly:
if(gb.update()){
gb.display.setColor(INVERT);{
gb.display.drawBitmap(0,0,room_1);
}
gb.display.setColor(BLACK);{
gb.display.drawBitmap(1,1,sever_front);
}
gb.display.setColor(WHITE);{
}
}
}
Sat Jul 30, 2016 10:19 pm
Sat Jul 30, 2016 10:33 pm
Sat Jul 30, 2016 10:57 pm
Sun Jul 31, 2016 6:59 am
Sun Jul 31, 2016 11:47 am
your movement exampl I understand that X and Y and vX and Vy are coordinates in space or on screen as it is. How do you get the integers in the brackets or what do they mean?
Sun Jul 31, 2016 10:09 pm
if(gb.buttons.repeat(BTN_UP,1)){
player_y = player_y - 1;}
if(player_y <= 0){ //////////// what are these integers, how are they calculated
player_y = 0;} //////////// what are these integers, how are they calculated
if(gb.buttons.repeat(BTN_DOWN,1)){
player_y = player_y + 1;}
if(player_y >= 40){ //////////// what are these integers, how are they calculated
player_y = 40;} //////////// what are these integers, how are they calculated
if(gb.buttons.repeat(BTN_RIGHT,1)){
player_x = player_x + 1;}
if(player_x >= 77){ //////////// what are these integers, how are they calculated
player_x = 77;} //////////// what are these integers, how are they calculated
if(gb.buttons.repeat(BTN_LEFT,1)){
player_x = player_x - 1;}
if(player_x <= -2){ //////////// what are these integers, how are they calculated
player_x = -2;} ///////////// what are these integers, how are they calculated
}
}
gb.display.drawBitmap(player_x,player_y,player);
Sun Jul 31, 2016 10:58 pm
if(gb.buttons.repeat(BTN_UP,1)){
player_y = player_y - 1;}
if(player_y <= 0){ //////////// If player co-ords equal less than or equal to zero (zero being the edge of the screen)
player_y = 0;} //////////// Make player co-ords zero (bring player back intob the screen
if(gb.buttons.repeat(BTN_UP,1)){
gb.display.drawBitmap(player_x,player_y,sprite_up);
}
Sun Jul 31, 2016 11:43 pm
Mon Aug 01, 2016 4:04 am