Understanding the language, error messages, etc.
by Duhjoker » Wed Aug 10, 2016 2:28 am
ok I placed the new code in the void loop where you said and im getting both cameray and camerax are not declared in this scope. I tried adding brackets and even added void render() but im stuck
- Code: Select all
#include <SPI.h>
#include <Gamebuino.h>
Gamebuino gb;
const byte room_1_1[] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,2,8,8,2,2,2,2,2,2,
2,2,2,2,2,1,4,8,8,2,2,2,2,2,2,
2,2,2,2,4,8,8,8,8,2,2,2,2,2,2,
2,2,2,4,8,8,8,8,8,2,2,2,2,2,2,
2,2,4,8,8,8,8,8,8,3,2,2,2,2,2,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
2,2,8,8,8,8,8,8,8,8,8,8,8,2,2,
2,2,8,8,8,8,8,8,8,8,8,8,8,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};
const byte room_1_2[] PROGMEM = {15,9,
8,8,
2,0,8,0,8,0,8,8,8,0,8,0,8,0,2,
2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
4,8,8,8,8,0,8,8,8,0,8,0,8,0,8,
8,0,8,0,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,0,8,8,8,0,8,0,8,0,8,
8,0,8,0,8,8,8,8,8,8,8,8,8,8,8,
6,8,8,8,8,0,8,8,8,0,8,0,8,0,8,
2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,2};
const byte room_1_3[] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
3,2,2,2,8,8,8,8,8,8,8,8,3,2,2,
8,3,2,2,8,8,8,8,8,8,8,8,8,2,2,
8,8,3,2,8,8,8,8,7,8,8,8,8,3,2,
8,8,8,8,8,8,8,7,8,7,8,8,8,8,8,
8,8,8,8,8,8,8,8,7,8,8,8,8,5,2,
8,8,8,8,8,8,8,8,8,8,8,8,8,2,2,
8,8,5,2,6,8,8,8,8,8,8,8,5,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};
const byte room_1_4[] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,2,2,4,3,2,2,2,2,2,
2,2,2,2,2,2,2,4,8,8,8,8,3,2,2,
2,2,2,2,4,8,8,8,8,8,8,8,8,2,2,
3,4,3,4,8,8,8,8,8,8,8,8,8,2,2,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
5,6,5,6,8,8,8,8,8,8,8,8,8,2,2,
2,2,2,2,6,8,8,8,8,8,8,8,8,2,2,
2,2,2,2,2,2,2,6,8,8,8,8,8,2,2,
2,2,2,2,2,2,2,2,6,5,2,2,2,2,2};
const byte room_1_5 [] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,2,2,2,2,2,8,8,8,0,
2,4,8,8,8,8,8,8,8,8,8,8,8,8,8,
4,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,11,17,17,17,17,17,17,17,
6,8,8,8,8,8,8,11,16,16,16,16,16,16,16,
2,2,2,6,8,8,8,10,16,16,16,16,16,16,16,
2,2,2,2,2,2,2,10,16,16,16,16,16,16,16};
const byte room_1_6[] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16};
const byte room_1_7[] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16};
const byte room_1_8[] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,
8,8,3,2,4,3,4,3,4,3,2,4,3,2,2,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16};
const byte room_1_9[] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,2,8,8,8,10,16,16,16,16,
4,3,2,4,3,2,4,8,8,8,10,16,16,16,16,
8,8,8,8,8,8,8,8,8,8,10,16,16,16,16,
8,8,8,8,8,8,8,8,8,8,10,16,16,16,16,
8,8,8,8,8,8,8,8,8,8,10,16,16,16,16,
17,17,17,17,17,17,17,17,17,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16};
const byte room_2_1[] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,4,8,8,8,8,8,8,2,8,8,8,3,2,
2,4,8,8,7,8,7,8,8,8,8,7,8,8,3,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,7,8,7,8,8,8,8,7,8,8,8,
8,8,8,8,8,8,8,8,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2,4,8,8,8,8,10,16,16,16,16,
2,2,2,2,4,8,8,8,8,8,10,16,16,16,16,
2,2,2,4,8,8,8,8,8,8,10,16,16,16,16,
2,2,2,8,8,8,8,8,8,8,10,16,16,16,16,
2,2,2,8,8,8,8,8,8,8,10,16,16,16,16,
2,2,2,6,8,8,8,8,8,8,10,16,16,16,16,
2,2,2,2,6,8,8,8,8,8,10,16,16,16,16,
2,2,2,2,2,8,8,8,8,8,10,16,16,16,16};
const byte room_4_1[] PROGMEM = {15,9,
8,8,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
const byte room_4_2[] PROGMEM = {15,9,
8,8,
16,16,16,16,16,16,13,8,8,8,0,0,0,0,0,
16,16,16,16,16,16,13,8,8,8,8,8,8,0,0,
16,16,16,16,16,16,13,8,8,8,8,8,8,0,0,
15,15,15,15,15,15,12,8,8,8,8,8,8,0,0,
8,8,8,8,8,8,8,8,8,8,8,8,8,0,0,
8,8,8,8,8,8,8,8,8,8,8,8,8,0,0,
8,8,8,8,8,8,8,8,8,8,8,8,8,0,0,
0,8,8,8,8,8,8,8,8,8,8,8,8,0,0,
0,0,0,0,0,0,0,8,8,8,0,0,0,0,0};
const byte room_4_3[] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,4,8,8,8,8,8,8,8,8,8,8,8,3,2,
2,8,8,8,8,8,8,8,8,8,8,8,8,8,2,
2,8,0,8,8,11,17,17,17,14,8,8,0,8,2,
2,8,8,8,8,10,16,16,16,13,8,8,8,8,2,
2,8,0,8,8,9,15,15,15,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2};
const byte room_4_7[] PROGMEM = {15,9,
8,8,
0,8,0,8,0,8,0,8,8,8,0,8,0,8,0,
0,8,8,8,8,8,8,8,8,8,8,8,8,8,0,
0,8,8,8,8,8,0,8,8,8,0,8,8,8,0,
8,8,0,8,0,8,8,8,0,8,8,8,0,8,8,
8,8,8,8,8,8,0,8,8,8,0,8,8,8,8,
8,8,0,8,0,8,8,8,0,8,8,8,0,8,8,
0,8,8,8,8,8,0,8,8,8,0,8,8,8,0,
0,8,8,8,8,8,8,8,8,8,8,8,8,8,0,
0,0,0,8,0,0,0,0,0,0,0,0,8,0,0};
const byte room_4_8[] PROGMEM = {15,9,
8,8,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,8,8,8,8,8,8,8,8,8,8,8,0,0,
0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,0,8,8,8,8,8,0,8,8,8,0,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,0,
8,8,8,8,0,8,8,8,8,8,0,8,8,8,0,
0,8,8,8,8,8,8,8,8,8,8,8,8,8,0,
0,0,8,8,8,8,8,8,8,8,8,8,8,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
const byte room_4_9[] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,8,8,8,8,10,16,16,16,16,
2,2,2,2,2,4,8,8,8,8,10,16,16,16,16,
2,2,2,2,4,8,8,8,8,8,10,16,16,16,16,
2,2,2,4,8,8,8,8,8,8,10,16,16,16,16,
2,2,2,8,8,8,8,8,8,8,10,16,16,16,16,
2,2,2,8,8,8,8,8,8,8,10,16,16,16,16,
2,2,2,6,8,8,8,8,8,8,10,16,16,16,16,
2,2,2,2,6,8,8,8,8,8,10,16,16,16,16,
2,2,2,2,2,8,8,8,8,8,10,16,16,16,16};
const byte bush[] PROGMEM = {B00101100,B01010010,B10001001,B01000010,B10010001,B01001010,B00100100,B01111110,};
const byte port_noir[] PROGMEM = {B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,};
const byte rock_terrain_master[] PROGMEM = {B01001101,B10100100,B10010001,B01001010,B10010000,B01100101,B10001001,B01011010,};
const byte rock_valley_ne[] PROGMEM = {B10101010,B10010101,B01000100,B00101001,B00110010,B00001010,B00000100,B00000011,};
const byte rock_valley_nw[] PROGMEM = {B01010101,B10101001,B00100010,B10010100,B01001100,B01010000,B00100000,B11000000,};
const byte rock_valley_se[] PROGMEM = {B00000011,B00000100,B0011001,B00010010,B00101001,B01000110,B10110001,B10001010,};
const byte rock_valley_sw[] PROGMEM = {B11000000,B00100000,B10011000,B01001000,B10010100,B01100010,B10001101,B01010001,};
const byte turtle_rock[] PROGMEM = {B01101100,B10110010,B11010001,B01010101,B01010010,B10011001,B10000001,B11111110,};
const byte void_tile[] PROGMEM = {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,};
const byte water_left_bottom[] PROGMEM = {B10001111,B10000000,B11110000,B10000000,B10001111,B10000000,B11110000,B11111111,};
const byte water_left_middle[] PROGMEM = {B10001111,B10000000,B11110000,B10000000,B10001111,B10000000,B11110000,B10000000,};
const byte water_left_top[] PROGMEM = {B11111111,B10000000,B11110000,B10001111,B10000000,B10000000,B11110000,B10000000,};
const byte water_right_bottom[] PROGMEM = {B1110001,B00000001,B0000111,B00000001,B11110001,B00000001,B00001111,B11111111,};
const byte water_right_middle[] PROGMEM = {B11110001,B00000001,B00001111,B00000001,B11110001,B00000001,B00001111,B00000001,};
const byte water_right_top[] PROGMEM = {B11111111,B00000001,B00001111,B00000001,B11110001,B00000001,B00001111,B00000001,};
const byte water_middle_bottom[] PROGMEM = {B11110000,B00000000,B00001111,B00000000,B11110000,B00000000,B00001111,B11111111,};
const byte water_middle_middle[] PROGMEM = {B11110000,B00000000,B00001111,B00000000,B11110000,B00000000,B00001111,B00000000,};
const byte water_middle_top[] PROGMEM = {B11111111,B00000000,B11110000,B00000000,B00001111,B00000000,B11110000,B00000000,};
const byte steps[] PROGMEM = {B10000001,B01111110,B10000001,B01111110,B10000001,B01111110,B10000001,B01111110,};
const byte *spritesheet[] = {bush, port_noir, rock_terrain_master, rock_valley_ne,
rock_valley_nw, rock_valley_se, rock_valley_sw, turtle_rock, void_tile, water_left_bottom,
water_left_middle, water_left_top, water_right_bottom, water_right_middle, water_right_top,
water_middle_bottom, water_middle_middle, water_middle_top, steps};
const byte sever_front_black[] PROGMEM = {8,8,0x39,0x7d,0x01,0x01,0xfe,0x01,0x7c,0x46};
const byte sever_front_grey[] PROGMEM = {8,8,0x82,0x82,0xd6,0x7c,0x01,0xa8,0x00,0x00,};
const byte sever_left_black[] PROGMEM = {8,8,0x9f,0xbe,0x80,0x82,0x7f,0x00,0x3e,0x62,};
const byte sever_left_grey[] PROGMEM = {8,8,0x00,0x00,0x17,0x3c,0x00,0x95,0x00,0x00,};
const byte sever_rear_black[] PROGMEM = {8,8,0x9c,0xbe,0xbe,0x80,0x7f,0x88,0x3e,0x62,};
const byte sever_rear_grey[] PROGMEM = {8,8,0x41,0x41,0x7f,0x3e,0x80,0x15,0x00,0x00,};
const byte sever_right_black[] PROGMEM = {8,8,0xf9,0x7d,0x01,0x41,0xfe,0x00,0x7c,0x46,};
const byte sever_right_grey[] PROGMEM = {8,8,0x00,0x00,0xe8,0x3c,0x00,0xa9,0x00,0x00,};
int player_x = 70;
int player_y = 70;
int player_direction = 0;
int x=0,y=0;
void setup() {
gb.begin();
gb.titleScreen(F("test"));
gb.setFrameRate(62);
gb.display.persistence = false;
}
/////////PLAYER_MOVEMENT\\\\\\\\\
void loop() {
if(gb.update()){
if (gb.buttons.repeat(BTN_RIGHT,1));//{x--;}
if (gb.buttons.repeat(BTN_LEFT,1));//{x++;}
if (gb.buttons.repeat(BTN_DOWN,1));//{y--;}
if (gb.buttons.repeat(BTN_UP,1));//{y++;}
//////camera controls
if(player_x > 64 ) {camerax-=2; player_x -=2;} //Y Scrolling right
else if(player_x < 10 ){camerax+=2; player_x +=2;} //Y Scrolling left
if(player_y > 28 ) {cameray-=2; player_y -=2;} //Y Scrolling Down
else if(player_y < 10 ){cameray+=2; player_y +=2;} //Y Scrolling Up
gb.display.drawTilemap(camerax,cameray,room_1_1,spritesheet); // draw the tilema
// gb.display.cursorY = 12; gb.display.println( x );gb.display.println( y );
if(gb.buttons.repeat(BTN_UP,1)){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,sever_rear_black);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,sever_rear_grey);
}
player_direction = 1;
player_y = player_y - 1;
if(checkcolision())player_y++; // ADD by Summoner123 - If have colision on the new position regreat one Pixel
}
if(player_y <= 0){
player_y = 0;}
if(gb.buttons.repeat(BTN_DOWN,1)){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,sever_front_black);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,sever_front_grey);
}
player_direction = 2;
player_y = player_y + 1;
if(checkcolision())player_y--; // ADD by Summoner123 - If have colision on the new position regreat one Pixel
}
if(player_y >= 40){
player_y = 40;}
if(gb.buttons.repeat(BTN_RIGHT,1)){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,sever_right_black);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,sever_right_grey);
}
player_direction = 3;
player_x = player_x + 1;
if(checkcolision())player_x--; // ADD by Summoner123 - If have colision on the new position regreat one Pixel
}
if(player_x >= 77){
player_x = 77;}
if(gb.buttons.repeat(BTN_LEFT,1)){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,sever_left_black);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,sever_left_grey);
}
player_direction = 4;
player_x = player_x - 1;
if(checkcolision())player_x++; // ADD by Summoner123 - If have colision on the new position regreat one Pixel
}
if(player_x <= -2){
player_x = -2;}
////////////PLAYER DIRECTION/////////////
if (player_direction == 1){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,sever_rear_black);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,sever_rear_grey);
}
}
else if (player_direction == 2){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,sever_front_black);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,sever_front_grey);
}
}
else if (player_direction == 3){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,sever_left_black);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,sever_left_grey);
}
}
else if (player_direction == 4){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,sever_right_black);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,sever_right_grey);
}
}
else { gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,sever_front_black);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,sever_front_grey);
}
}
}
}
bool checkcolision() // Transformed it into a function
{
uint16_t i;
for(i=0; i < gb.display.numcolision + 1; i++)
{
if(gb.collideRectRect(player_x,player_y,6,6,gb.display.solid[i].x,gb.display.solid[i].y,8,8))
{
if(gb.display.solid[i].spritecol == void_tile); //Do nothing because it's floor - This line not needed
if(gb.display.solid[i].spritecol == bush);
else if(gb.display.solid[i].spritecol == port_noir);
else if(gb.display.solid[i].spritecol == rock_terrain_master);//{gb.popup(F(" ""Rock"" "),1); return true;} //Return True if character have touched the wall
else if(gb.display.solid[i].spritecol == rock_valley_ne);
else if(gb.display.solid[i].spritecol == rock_valley_nw);
else if(gb.display.solid[i].spritecol == rock_valley_se);
else if(gb.display.solid[i].spritecol == rock_valley_sw);
else if(gb.display.solid[i].spritecol == turtle_rock);
else if(gb.display.solid[i].spritecol == water_left_bottom);
else if(gb.display.solid[i].spritecol == water_left_middle);
else if(gb.display.solid[i].spritecol == water_left_top);
else if(gb.display.solid[i].spritecol == water_right_bottom);
else if(gb.display.solid[i].spritecol == water_right_middle);
else if(gb.display.solid[i].spritecol == water_right_top);
else if(gb.display.solid[i].spritecol == water_middle_bottom);
else if(gb.display.solid[i].spritecol == water_middle_middle);
else if(gb.display.solid[i].spritecol == water_middle_top);
}
}
//return false; // Return false if don't touch anything
}
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by Duhjoker » Wed Aug 10, 2016 5:45 am
Driving me nuts!!! I've tried moving and adding render() and I can't get it to compile. It gives me Camerax or Cameray not declared in this scope if I put it in void render I get bracket errors and I can't figure out where the commands go and Inbetween what brackets.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by naed » Wed Aug 10, 2016 6:13 am
Oh crap, I forgot you need to add
- Code: Select all
int camerax = 0
Int cameray = 0
Before void setup()
-
naed
-
- Posts: 140
- Joined: Tue May 31, 2016 3:18 pm
by Duhjoker » Wed Aug 10, 2016 7:44 am
Ok cool I did that and now it compiles I removed the void render() and added the above but it accepts
- Code: Select all
Int camerax=0,cameray=0;
But now I can't move the character Sprite.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by naed » Wed Aug 10, 2016 7:49 am
Give me 15 mins and I'll post up the code that I have working
EDIT
- Code: Select all
#include <SPI.h>
#include <Gamebuino.h>
Gamebuino gb;
const byte tilemap[] PROGMEM = {15,9,
8,8,
2,2,2,2,2,2,2,8,8,2,2,2,2,2,2,
2,2,2,2,2,1,4,8,8,2,2,2,2,2,2,
2,2,2,2,4,8,8,8,8,2,2,2,2,2,2,
2,2,2,4,8,8,8,8,8,2,2,2,2,2,2, /////////112x64 pix res
2,2,4,8,8,8,8,8,8,3,2,2,2,2,2,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
2,2,8,8,8,8,8,8,8,8,8,8,8,2,2,
2,2,8,8,8,8,8,8,8,8,8,8,8,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};
const byte bush[] PROGMEM = {B00101100,B01010010,B10001001,B01000010,B10010001,B01001010,B00100100,B01111110,};
const byte port_noir[] PROGMEM = {B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,};
const byte rock_terrain_master[] PROGMEM = {B01001101,B10100100,B10010001,B01001010,B10010000,B01100101,B10001001,B01011010,};
const byte rock_valley_ne[] PROGMEM = {B10101010,B10010101,B01000100,B00101001,B00110010,B00001010,B00000100,B00000011,};
const byte rock_valley_nw[] PROGMEM = {B01010101,B10101001,B00100010,B10010100,B01001100,B01010000,B00100000,B11000000,};
const byte rock_valley_se[] PROGMEM = {B00000011,B00000100,B0011001,B00010010,B00101001,B01000110,B10110001,B10001010,};
const byte rock_valley_sw[] PROGMEM = {B11000000,B00100000,B10011000,B01001000,B10010100,B01100010,B10001101,B01010001,};
const byte turtle_rock[] PROGMEM = {B01101100,B10110010,B11010001,B01010101,B01010010,B10011001,B10000001,B11111110,};
const byte void_tile[] PROGMEM = {B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,};
const byte water_left_bottom[] PROGMEM = {B10001111,B10000000,B11110000,B10000000,B10001111,B10000000,B11110000,B11111111,};
const byte water_left_middle[] PROGMEM = {B10001111,B10000000,B11110000,B10000000,B10001111,B10000000,B11110000,B10000000,};
const byte water_left_top[] PROGMEM = {B11111111,B10000000,B11110000,B10001111,B10000000,B10000000,B11110000,B10000000,};
const byte water_right_bottom[] PROGMEM = {B1110001,B00000001,B0000111,B00000001,B11110001,B00000001,B00001111,B11111111,};
const byte water_right_middle[] PROGMEM = {B11110001,B00000001,B00001111,B00000001,B11110001,B00000001,B00001111,B00000001,};
const byte water_right_top[] PROGMEM = {B11111111,B00000001,B00001111,B00000001,B11110001,B00000001,B00001111,B00000001,};
const byte water_middle_bottom[] PROGMEM = {B11110000,B00000000,B00001111,B00000000,B11110000,B00000000,B00001111,B11111111,};
const byte water_middle_middle[] PROGMEM = {B11110000,B00000000,B00001111,B00000000,B11110000,B00000000,B00001111,B00000000,};
const byte water_middle_top[] PROGMEM = {B11111111,B00000000,B11110000,B00000000,B00001111,B00000000,B11110000,B00000000,};
const byte *spritesheet[] = {bush, port_noir, rock_terrain_master, rock_valley_ne,
rock_valley_nw, rock_valley_se, rock_valley_sw, turtle_rock, void_tile, water_left_bottom,
water_left_middle, water_left_top, water_right_bottom, water_right_middle, water_right_top,
water_middle_bottom, water_middle_middle, water_middle_top};
const byte backblack[] PROGMEM = {8,8,0x7E,0x42,0x42,0x3C,0x7E,0x3C,0x3C,0x24,};
const byte backgrey[] PROGMEM = {8,8,0x1,0x1,0x1,0xC1,0x81,0xC0,0x40,0x0,};
const byte frontblack[] PROGMEM = {8,8,0x7E,0x66,0x42,0x38,0x78,0x38,0x3C,0x24,};
const byte frontgrey[] PROGMEM = {8,8,0x80,0x80,0x80,0x87,0x87,0x7,0x2,0x0,};
const byte leftblack[] PROGMEM = {8,8,0x3E,0x32,0x22,0x1C,0x1C,0x1C,0x1C,0x14,};
const byte leftgrey[] PROGMEM = {8,8,0x0,0x0,0x0,0x60,0x60,0x60,0x40,0x0,};
const byte rightblack[] PROGMEM = {8,8,0x7C,0x4C,0x44,0x38,0x3C,0x38,0x38,0x28,};
const byte rightgrey[] PROGMEM = {8,8,0x2,0x2,0x2,0x2,0x2,0x0,0x0,0x0,};
int player_x = 50; //cant get these to center
int player_y = 35; //cant get these to center
int player_direction = 0;
int x=0,y=0; ///if 0 player spite will not move, -50,50 no tilemap
//////CAMERA//////
int camerax = 0 ;
int cameray = 0 ;
int xmax = -100;
void setup() {
gb.begin();
gb.titleScreen(F("test"));
gb.setFrameRate(62); ////////for sprite
gb.display.persistence = false;
}
/////////PLAYER_MOVEMENT\\\\\\\\\
void loop() {
if(gb.update()){
if (gb.buttons.repeat(BTN_RIGHT,1));{x--;}
if (gb.buttons.repeat(BTN_LEFT,1));{x++;}
if (gb.buttons.repeat(BTN_DOWN,1));{y--;}
if (gb.buttons.repeat(BTN_UP,1));{y++;}
if(player_x > 64 ) {camerax-=2; player_x -=2;} //Y Scrolling right
else if(player_x < 10 ){camerax+=2; player_x +=2;} //Y Scrolling left
if(player_y > 28 ) {cameray-=2; player_y -=2;} //Y Scrolling Down
else if(player_y < 10 ){cameray+=2; player_y +=2;} //Y Scrolling Up
gb.display.drawTilemap(camerax,cameray,tilemap,spritesheet); // draw the tilemap
// gb.display.cursorY = 12; gb.display.println( x );gb.display.println( y );
if(gb.buttons.repeat(BTN_UP,1)){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,backblack);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,backgrey);
}
player_direction = 1;
player_y = player_y - 1;
if(checkcolision())player_y++; // ADD by Summoner123 - If have colision on the new position regreat one Pixel
}
if(player_y <= 0){
player_y = 0;}
if(gb.buttons.repeat(BTN_DOWN,1)){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,frontblack);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,frontgrey);
}
player_direction = 2;
player_y = player_y + 1;
if(checkcolision())player_y--; // ADD by Summoner123 - If have colision on the new position regreat one Pixel
}
if(player_y >= 40){
player_y = 40;}
if(gb.buttons.repeat(BTN_RIGHT,1)){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,rightblack);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,rightgrey);
}
player_direction = 3;
player_x = player_x + 1;
if(checkcolision())player_x--; // ADD by Summoner123 - If have colision on the new position regreat one Pixel
}
if(player_x >= 77){
player_x = 77;}
if(gb.buttons.repeat(BTN_LEFT,1)){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,leftblack);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,leftgrey);
}
player_direction = 4;
player_x = player_x - 1;
if(checkcolision())player_x++; // ADD by Summoner123 - If have colision on the new position regreat one Pixel
}
if(player_x <= -2){
player_x = -2;}
////////////PLAYER DIRECTION/////////////
if (player_direction == 1){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,backblack);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,backgrey);
}
}
else if (player_direction == 2){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,frontblack);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,frontgrey);
}
}
else if (player_direction == 3){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,rightblack);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,rightgrey);
}
}
else if (player_direction == 4){
gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,leftblack);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,leftgrey);
}
}
else { gb.display.setColor(BLACK);{
gb.display.drawBitmap(player_x,player_y,frontblack);
}
gb.display.setColor(GRAY);{
gb.display.drawBitmap(player_x,player_y,frontgrey);
}
}
}
}
bool checkcolision() // Transformed it into a function
{
uint16_t i;
for(i=0; i < gb.display.numcolision + 1; i++)
{
if(gb.collideRectRect(player_x,player_y,8,8,gb.display.solid[i].x,gb.display.solid[i].y,8,8))///changed player_x,y back to 8
{
// if(gb.display.solid[i].spritecol == void_tile); //Do nothing because it's floor - This line not needed
if(gb.display.solid[i].spritecol == bush) return true;
else if(gb.display.solid[i].spritecol == port_noir) return true;
else if(gb.display.solid[i].spritecol == rock_terrain_master) {gb.popup(F(" ""Rock"" "),1); return true;} //Return True if character have touched the wall
else if(gb.display.solid[i].spritecol == rock_valley_ne) return true;
else if(gb.display.solid[i].spritecol == rock_valley_nw) return true;
else if(gb.display.solid[i].spritecol == rock_valley_se) return true;
else if(gb.display.solid[i].spritecol == rock_valley_sw) return true;
else if(gb.display.solid[i].spritecol == turtle_rock) return true;
else if(gb.display.solid[i].spritecol == water_left_bottom) return true;
else if(gb.display.solid[i].spritecol == water_left_middle) return true;
else if(gb.display.solid[i].spritecol == water_left_top) return true;
else if(gb.display.solid[i].spritecol == water_right_bottom) return true;
else if(gb.display.solid[i].spritecol == water_right_middle) return true;
else if(gb.display.solid[i].spritecol == water_right_top) return true;
else if(gb.display.solid[i].spritecol == water_middle_bottom) return true;
else if(gb.display.solid[i].spritecol == water_middle_middle) return true;
else if(gb.display.solid[i].spritecol == water_middle_top) return true;
}
}
return false; // Return false if don't touch anything
}
this is how i got it working
-
naed
-
- Posts: 140
- Joined: Tue May 31, 2016 3:18 pm
by Duhjoker » Wed Aug 10, 2016 8:15 am
Thank you. I could see right away I for got to add some stuff. Gonna fix mine now. Thank you!!!
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by Duhjoker » Wed Aug 10, 2016 8:42 am
I must have missed some thing I've been playing with it all night. ill have to take care of it tomorrow. Thank you for the example to proof with.
Now we just need to figure out how to connect these rooms. This might prove an interesting task as some room have multiple entrances and exits.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by Duhjoker » Wed Aug 10, 2016 9:03 am
Lol I got mine working now but the Sprite seems to defy the natural laws of physics. If you move the character Sprite through the openings he just keeps going til the room repeats and on and on.
Might have to make my rooms one pixel bigger so they don't show void space.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
by naed » Wed Aug 10, 2016 10:55 am
There is no boundary set in my code for the edge of the maps, just collision code for sprites...
I was unsure what you wanted to do with your maps so left the boundary collision code out
-
naed
-
- Posts: 140
- Joined: Tue May 31, 2016 3:18 pm
by Duhjoker » Wed Aug 10, 2016 8:13 pm
Oh ok!!! I think we will just do a room by room basis.
-
Duhjoker
-
- Posts: 446
- Joined: Sat Jul 02, 2016 4:57 am
- Location: Where Palm trees grow
Return to Programming Questions
Who is online
Users browsing this forum: No registered users and 3 guests