Sat Jul 25, 2015 11:53 am
Sat Jul 25, 2015 7:52 pm
Sat Jul 25, 2015 8:52 pm
Mon Jul 27, 2015 12:21 am
Mon Jul 27, 2015 9:30 am
Thu Jul 30, 2015 5:24 pm
Sorunome wrote:Looking awesome!
Also, you'll have to adjust the output as I changed a bit on how drawTIlemap is working, more about that here: viewtopic.php?f=12&t=3213#p10002
const byte tilemap[] PROGMEM = {10,10,
8, 8,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0,77,77, 0, 0, 0, 0,
0, 0, 0,77,77,77,77, 0, 0, 0,
0, 0,77,77, 1, 1,77,77, 0, 0,
0,77,77, 1, 1, 1, 1,77,77, 0,
0,77,77, 1, 1, 1, 1,77,77, 0,
0, 0,77,77, 1, 1,77,77, 0, 0,
0, 0, 0,77,77,77,77, 0, 0, 0,
0, 0, 0, 0,77,77, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ;
const byte arvore[] PROGMEM = {
B00010000,
B00101000,
B01000100,
B10000010,
B10000010,
B01101100,
B00101000,
B01010100 } ;
const byte grass1[] PROGMEM = {
B00000000,
B01000100,
B00100010,
B00011001,
B01000000,
B00000100,
B00100010,
B00000000 } ;
const byte *spritesheet[] = { arvore,grass1 } ;
typedef struct{ //line 171 "Public Variables
int x; //X coordinate
int y; //Y coordinate
const byte *spritecol; //Sprite of object
}object;
object solid[60];
byte numcolision = 0; //count of solid objects
numcolision = 0; //Line 735 - clear numcolision
for(uint8_t ddy = startDdy;ddy < maxDdy;ddy++){
for(uint8_t ddx = startDdx;ddx < maxDdx;ddx++){
int8_t drawX = ddx*tile_width + x + dx;
int8_t drawY = ddy*tile_height + y + dy;
uint8_t tile = pgm_read_byte(tilemap + ddy*tilemap_width + ddx);
if(drawX >= dx && drawY >= dy && drawX <= (ddw-tile_width) && drawY <= (ddh-tile_height)){
drawBitmap(drawX,drawY,spritesheet[tile]);
solid[numcolision].x = drawX; //Save X coordinate
solid[numcolision].y = drawY; //Save Y coordinate
solid[numcolision].spritecol = spritesheet[tile]; //Save Sprite of tile
numcolision++; //Increment numcolision
}else{ // we need to draw a partial bitmap
drawBitmap(drawX,drawY,spritesheet[tile],dx,dy,dw,dh);
}
}
}
for(i=0; i < gb.display.numcolision + 1; i++)
{
if(gb.collideRectRect(player.posx,player.posy,8,8,gb.display.solid[i].x,gb.display.solid[i].y,8,8))
{
if(gb.display.solid[i].spritecol == floor1); //Do nothing because it's floor
else if(gb.display.solid[i].spritecol == arvore)gb.popup(F("Tree"),10);
else if(gb.display.solid[i].spritecol == agua2 )gb.popup(F("Water"),10);
else if(gb.display.solid[i].spritecol == agua3 )gb.popup(F("Water"),10);
else if(gb.display.solid[i].spritecol == tijolo)gb.popup(F("Brick"),10);
}
}
if(gb.buttons.repeat(BTN_B,1))
{
gb.display.print("CPU Load: ");
gb.display.print(gb.getCpuLoad());
gb.display.cursorX = 0;
}
Tue Oct 06, 2015 3:43 pm
Thu Oct 15, 2015 1:09 pm
Zvoc47 wrote:Wow! Awesome!
Can you please make a download link outside of 4shared like MediaFire or Dropbox? I'm not comfortable with having to log in to my social networks in order to download.