Wed Oct 05, 2016 1:01 am
const byte Map[] PROGMEM = {13,9,
8,8,
0,0,0,0,0,0,0,0,0,0,0,0,2,
2,1,2,5,5,8,0,0,0,0,0,0,7,
3,0,0,0,0,8,0,0,0,0,0,0,2,
3,0,0,0,0,0,4,5,2,0,0,0,3,
2,0,2,0,0,0,0,0,0,0,0,0,3,
3,0,3,0,0,0,0,0,0,0,0,0,3,
3,0,3,0,0,0,2,5,5,0,5,5,2,
3,0,3,0,9,0,3,0,9,0,0,0,7,
2,0,2,1,1,1,2,1,1,1,1,1,2,
};
const byte PROGMEM Brick[] = //ID: 0
{
8,8,
B11111111,
B00100001,
B11111111,
B10001000,
B11111111,
B00100001,
B11111111,
B00000000,
};
#include <Backlight.h>
#include <Battery.h>
#include <Buttons.h>
#include <Display.h>
#include <Gamebuino.h>
#include <Sound.h>
#include <SPI.h>
Gamebuino gb;
byte PlayerPositionX;
byte PlayerPositionY;
byte CurrentMapSizeX;
byte CurrentMapSizeY;
const byte PROGMEM Brick[] = //ID: 0
{
8,8,
B11111111,
B00100001,
B11111111,
B10001000,
B11111111,
B00100001,
B11111111,
B00000000,
};
const byte PROGMEM SharpBrick[]= //ID: 2
{
8,8,
B11111111,
B11000011,
B10100101,
B10011001,
B10011001,
B10100101,
B11000011,
B11111111,
};
const byte PROGMEM TowerBrick[]= //ID: 3
{
8,8,
B10101101,
B10110101,
B10101101,
B10110101,
B10101101,
B10110101,
B10101101,
B10110101,
};
const byte PROGMEM Piston[]= //ID: 4
{
8,8,
B00000000,
B01111110,
B00100100,
B00100100,
B01000010,
B00011000,
B01111110,
B00000000,
};
const byte PROGMEM Holder[]= //ID: 5
{
8,8,
B11111111,
B10100101,
B11111111,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
};
const byte PROGMEM Teleporter1[]= //ID: 6
{
8,8,
B11111111,
B10101011,
B11010110,
B10101100,
B10101100,
B11010110,
B10101011,
B11111111,
};
const byte PROGMEM Teleporter0[]= //ID: 7
{
8,8,
B11111111,
B11010101,
B01101011,
B00110101,
B00110101,
B01101011,
B11010101,
B11111111,
};
const byte PROGMEM Wall[]= //ID: 8
{
8,8,
B11110000,
B11110000,
B10010000,
B10010000,
B10010000,
B10010000,
B10010000,
B11110000,
};
const byte Map[] PROGMEM = {13,9,
8,8,
0,0,0,0,0,0,0,0,0,0,0,0,2,
2,1,2,5,5,8,0,0,0,0,0,0,7,
3,0,0,0,0,8,0,0,0,0,0,0,2,
3,0,0,0,0,0,4,5,2,0,0,0,3,
2,0,2,0,0,0,0,0,0,0,0,0,3,
3,0,3,0,0,0,0,0,0,0,0,0,3,
3,0,3,0,0,0,2,5,5,0,5,5,2,
3,0,3,0,9,0,3,0,9,0,0,0,7,
2,0,2,1,1,1,2,1,1,1,1,1,2,
};
//For info about map:
//http://gamebuino.com/forum/viewtopic.php?f=8&t=3492&p=12227&hilit=map#p12227
void setup() {
// put your setup code here, to run once:
gb.begin();
gb.titleScreen(F("BIGBLACKBOX Testing"));
CurrentMapSizeX = 13;
CurrentMapSizeY = 9;
}
void loop() {
// put your main code here, to run repeatedly:
if(gb.update()) {
if(gb.buttons.pressed(BTN_UP)) {
PlayerPositionY--;
}
if(gb.buttons.pressed(BTN_DOWN)) {
PlayerPositionY++;
}
if(gb.buttons.pressed(BTN_RIGHT)) {
PlayerPositionX++;
}
if(gb.buttons.pressed(BTN_LEFT)) {
PlayerPositionX--;
}
//Drawing
for(int x = 0; x < CurrentMapSizeX; x++) {
for(int y = 0; y < CurrentMapSizeY; y++) {
byte Id;
Id = Map[x+y*CurrentMapSizeX];
//gb.display.print(Id);
if(Id == 1) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Brick);
}
if(Id == 2) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, SharpBrick);
}
if(Id == 3) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, TowerBrick);
}
if(Id == 4) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Piston);
}
if(Id == 5) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Holder);
}
if(Id == 6) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Teleporter1);
}
if(Id == 7) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Teleporter0);
}
if(Id == 8) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Wall);
}
}
}
//gb.display.drawBitmap(10,10,Brick);
}
}
Wed Oct 05, 2016 1:45 am
Wed Oct 05, 2016 7:45 am
Wed Oct 05, 2016 4:31 pm
Wed Oct 05, 2016 7:02 pm
Wed Oct 05, 2016 8:57 pm
#include <Backlight.h>
#include <Battery.h>
#include <Buttons.h>
#include <Display.h>
#include <Gamebuino.h>
#include <Sound.h>
#include <SPI.h>
Gamebuino gb;
byte PlayerPositionX;
byte PlayerPositionY;
byte CurrentMapSizeX;
byte CurrentMapSizeY;
const byte PROGMEM Brick[] = //ID: 1
{
8,8,
B00000000,
B11011110,
B00000000,
B01110111,
B00000000,
B11011110,
B00000000,
B11111111,
};
const byte PROGMEM SharpBrick[]= //ID: 2
{
8,8,
B00000000,
B00111100,
B01011010,
B01100110,
B01100110,
B01011010,
B00111100,
B00000000,
};
const byte PROGMEM TowerBrick[]= //ID: 3
{
8,8,
B01010010,
B01001010,
B01010010,
B01001010,
B01010010,
B01001010,
B01010010,
B01001010,
};
const byte PROGMEM Piston[]= //ID: 4
{
8,8,
B11111111,
B10000001,
B11011011,
B11011011,
B10111101,
B11100111,
B10000001,
B11111111,
};
const byte PROGMEM Holder[]= //ID: 5
{
8,8,
B00000000,
B01011010,
B00000000,
B11111111,
B11111111,
B11111111,
B11111111,
B11111111,
};
const byte PROGMEM Teleporter0[]= //ID: 6
{
8,8,
B00000000,
B01010100,
B00101001,
B01010011,
B01010011,
B00101001,
B01010100,
B00000000,
};
const byte PROGMEM Teleporter1[]= //ID: 7
{
8,8,
B00000000,
B00101010,
B10010100,
B11001010,
B11001010,
B10010100,
B00101010,
B00000000,
};
const byte PROGMEM Wall[]= //ID: 8
{
8,8,
B00001111,
B00001111,
B01101111,
B01101111,
B01101111,
B01101111,
B01101111,
B00001111,
};
const byte Map[] PROGMEM = {13,9,
8,8,
0,0,0,0,0,0,0,0,0,0,0,0,2,
2,1,2,5,5,8,0,0,0,0,0,0,7,
3,0,0,0,0,8,0,0,0,0,0,0,2,
3,0,0,0,0,0,4,5,2,0,0,0,3,
2,0,2,0,0,0,0,0,0,0,0,0,3,
3,0,3,0,0,0,0,0,0,0,0,0,3,
3,0,3,0,0,0,2,5,5,0,5,5,2,
3,0,3,0,9,0,3,0,9,0,0,0,7,
2,0,2,1,1,1,2,1,1,1,1,1,2,
};
//For info about map:
//http://gamebuino.com/forum/viewtopic.php?f=8&t=3492&p=12227&hilit=map#p12227
void setup() {
// put your setup code here, to run once:
gb.begin();
gb.titleScreen(F("BIGBLACKBOX Testing"));
CurrentMapSizeX = 13;
CurrentMapSizeY = 9;
}
void loop() {
// put your main code here, to run repeatedly:
if(gb.update()) {
if(gb.buttons.pressed(BTN_UP)) {
PlayerPositionY = PlayerPositionY + 1;
}
if(gb.buttons.pressed(BTN_DOWN)) {
PlayerPositionY = PlayerPositionY - 1;
}
if(gb.buttons.pressed(BTN_RIGHT)) {
PlayerPositionX = PlayerPositionX + 1;
}
if(gb.buttons.pressed(BTN_LEFT)) {
PlayerPositionX = PlayerPositionX - 1;
}
//Drawing
for(int x = 0; x < CurrentMapSizeX; x++) {
for(int y = 0; y < CurrentMapSizeY; y++) {
byte Id;
Id = Map[x+y*CurrentMapSizeX];
if(Id == 1) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Brick);
}
if(Id == 2) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, SharpBrick);
}
if(Id == 3) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, TowerBrick);
}
if(Id == 4) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Piston);
}
if(Id == 5) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Holder);
}
if(Id == 6) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Teleporter1);
}
if(Id == 7) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Teleporter0);
}
if(Id == 8) {
gb.display.drawBitmap(x*8-PlayerPositionX,y*8-PlayerPositionY, Wall);
}
}
}
}
}
Wed Oct 05, 2016 9:09 pm
Thu Oct 06, 2016 4:37 pm
Fri Oct 07, 2016 12:59 am
Fri Oct 07, 2016 7:06 am