[solved] TilemapRamino example

Understanding the language, error messages, etc.

[solved] TilemapRamino example

Postby Duhjoker » Thu May 25, 2017 10:18 pm

The problem has been solved. The problem took up to functions to fix. First the width and height in the tilemap need to be reversed and the same for fillrect().

Hey guys

I can't seem to be able to get summoner123's tilemap going with the color library. So I. Looking at the tilemapramino example trying to figure it out. Specifically the the draw world function. It's seems it's set up for random generated maps but I need to make one where I choose the exact location of each tile.

How can I do so?

For summoners example I just do a

constant byte tilemap(16,16,32,32,

Then list each tile in an integer as listed on the Sprite sheet.
Last edited by Duhjoker on Thu Jun 22, 2017 11:19 pm, edited 1 time in total.
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: TilemapRamino example

Postby rodot » Fri May 26, 2017 7:30 am

Hey Duhjoker,
As already said, please give context to your questions, and provide a SSCCE. Because here, nobody could answer even if they wanted to. Please do your homework. Thanks.
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: TilemapRamino example

Postby Sorunome » Fri May 26, 2017 1:21 pm

Since you already posted a topic about your question, please do not go around PM'ing people such as me just to ask them the exact same thing again, you already asked your question in this topic so that should be sufficiant. No reason to PM people about it.
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm

Re: TilemapRamino example help

Postby Duhjoker » Fri May 26, 2017 8:38 pm

Ok if I could get some actual help I'll quit asking questions but the problem is that no one is actually answering my questions about this. I have researched and tried to fix this problem for way longer than I would like. I have been on several different sites but nobody knows how to fix it. Now since the tileRAMino example is a part of the OG library I failed to give documentation because you should have knowledge of it with out. Other wise I usually bomb my posts with documentation!!!! Go ahead and go look. If you need a certain piece of documentation please ask and I'll provide. But getting on to me about asking questions that no one has answered on a site designed to ask and answer questions and telling me I haven't done things that I actually have is a lil ridiculous.

I don't want to bother guys but y'all are the only ones that know this library enough to help.


The first post should pretty self explanatory. I can't get the Tilemap() function to work and the tilemapRamino example only shows how to do random tiles displayed. Again how can I use the example to draw a tilemap in an array of my choosing?
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: TilemapRamino example

Postby naed » Fri May 26, 2017 9:34 pm

Can you link to the tilemapramino example you are referencing
User avatar
naed
 
Posts: 140
Joined: Tue May 31, 2016 3:18 pm

Re: TilemapRamino example

Postby Duhjoker » Fri May 26, 2017 10:13 pm

Naed!!! Thank you!!! No problem!!!!!

Here is the link........
https://github.com/Rodot/Gamebuino/tree ... TileMapRAM

From what i can tell it works alot like tilemap(). Which i would rather have but ive been every where and tried every thing for months and i get aggravated so i move to the next problem. But this stuff.... Im desperate!!!

here is my sketch just in case some one wants to look......
Code: Select all

////////////////////////////////
#include <Grafx_esp.h>
#include "SPI.h"

#define TFT_SCK 18
#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_DC 5
#define TFT_CS 22
#define TFT_RST 17
Grafx_esp tft = Grafx_esp(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCK, TFT_MISO);
//Adafruit_GFX_Button button;
uint8_t use_clip_rect = 0;
uint8_t use_set_origin = 0;
uint8_t use_fb = 0;


int player_x = 160;
int player_y = 110;
int player_direction = 2;


int x=-0,y=0;


//////////Paul_Atreades
//////////paul front

const byte paul_frontblack[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x02,0x40,0x02,0x30,0x0c,0x38,0x1c,0x4c,0x32,0x4f,0xf2,0x39,0x9c,0x16,0x68,0x11,0x88,0x08,0x10,0x0e,0x70};

const byte paul_frontblue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x02,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x01,0x80,0x06,0x60,0x06,0x60,0x00,0x00};

const byte paul_frontbrown[] PROGMEM = {16,16,
0x0e,0x70,0x1b,0xd8,0x16,0x68,0x19,0x98,0x20,0x04,0x16,0x68,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_frontgreen[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_frontgrey[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x08,0x10,0x00,0x00,0x00,0x00};

const byte paul_frontpink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x60,0x0f,0xf0,0x29,0x94,0x3d,0xbc,0x0d,0xb0,0x07,0xe0,0x33,0xcc,0x30,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_frontred[] PROGMEM = {16,16,
0x01,0x80,0x04,0x20,0x09,0x90,0x20,0x04,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0,0x00,0x00,0x00,0x00};

////////paul_front_walk_1

const byte paul_frontw1black[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x02,0x40,0x02,0x30,0x0e,0x38,0x1a,0x24,0x3c,0x27,0x98,0x19,0x68,0x0e,0x88,0x0e,0x10,0x00,0x10,0x00,0x70};

const byte paul_frontw1blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x02,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x80,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00};

const byte paul_frontw1brown[] PROGMEM = {16,16,
0x0e,0x70,0x1b,0xd8,0x16,0x68,0x19,0x98,0x20,0x04,0x16,0x68,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_frontw1green[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_frontw1grey[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_frontw1pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x60,0x0f,0xf0,0x29,0x94,0x3d,0xbc,0x0d,0xb0,0x07,0xe4,0x1b,0xc0,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_frontw1red[] PROGMEM = {16,16,
0x01,0x80,0x04,0x20,0x09,0x90,0x20,0x04,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

////////paul_front_walk_2

const byte paul_frontw2black[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x02,0x40,0x02,0x70,0x0c,0x58,0x1c,0x3c,0x24,0x19,0xe4,0x16,0x98,0x11,0x70,0x08,0x70,0x08,0x00,0x0e,0x00};

const byte paul_frontw2blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x02,0x40,0x00,0x00,0x00,0x00,0x06,0x00,0x01,0x60,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00};

const byte paul_frontw2brown[] PROGMEM = {16,16,
0x0e,0x70,0x1b,0xd8,0x16,0x68,0x19,0x98,0x20,0x04,0x16,0x68,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_frontw2green[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_frontw2grey[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_frontw2pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x60,0x0f,0xf0,0x29,0x94,0x3d,0xbc,0x0d,0xb0,0x27,0xe0,0x03,0xd8,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_frontw2red[] PROGMEM = {16,16,
0x01,0x80,0x04,0x20,0x09,0x90,0x20,0x04,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

////////paul left

const byte paul_leftblack[] PROGMEM = {16,16,
0x00,0x00,0x00,0x0,0x00,0x00,0x00,0x00,0x10,0x00,0x14,0x00,0x10,0x00,0x10,0x00,0x08,0x60,0x07,0xe0,0x00,0x20,0x03,0x20,0x04,0xe0,0x04,0x20,0x01,0xc0,0x03,0xc0};

const byte paul_leftblue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00};

const byte paul_leftbrown[] PROGMEM = {16,16,
0x0e,0xd8,0x0d,0xa8,0x1b,0x74,0x3e,0xec,0x01,0xd8,0x00,0xb4,0x00,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_leftgreen[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_leftgrey[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0xc0,0x00,0x00,0x00,0x00};

const byte paul_leftpink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x0b,0x00,0x0b,0x60,0x0f,0xe0,0x07,0x80,0x00,0x00,0x00,0xc0,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_leftred[] PROGMEM = {16,16,
0x01,0x20,0x12,0x54,0x24,0x88,0x01,0x10,0x00,0x24,0x00,0x48,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

///////paul_left_walk

const byte paul_leftwblack[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x14,0x00,0x10,0x00,0x10,0x00,0x08,0x60,0x04,0xe0,0x1f,0x98,0x24,0x94,0x13,0xe4,0x12,0x44,0x02,0x24,0x0e,0x18};

const byte paul_leftwblue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x08,0x08,0x18,0x0c,0x38,0x0c,0x18,0x00,0x00};

const byte paul_leftwbrown[] PROGMEM = {16,16,
0x0e,0xe8,0x0d,0xd8,0x1b,0xb4,0x3f,0x6c,0x01,0xd8,0x00,0xb4,0x00,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_leftwgreen[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_leftwgrey[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_leftwpink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x0b,0x00,0x0b,0x60,0x0f,0xe0,0x07,0x80,0x00,0x00,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_leftwred[] PROGMEM = {16,16,
0x01,0x10,0x12,0x24,0x24,0x48,0x00,0x90,0x00,0x24,0x00,0x48,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

////////paul_rear

const byte paul_rearblack[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x02,0x40,0x02,0x30,0x0c,0x38,0x1c,0x49,0x92,0x5e,0x7a,0x39,0x9c,0x16,0x68,0x11,0x80,0x08,0x10,0x0e,0x70};

const byte paul_rearblue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x60,0x01,0x80,0x06,0x60,0x01,0x80,0x06,0x60,0x06,0x60,0x00,0x00};

const byte paul_rearbrown[] PROGMEM = {16,16,
0x0d,0xb0,0x0b,0xd0,0x1d,0xb8,0x1a,0x58,0x37,0xec,0x0d,0xb0,0x0b,0xd0,0x02,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_reargrey[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x08,0x10,0x00,0x00,0x00,0x00};

const byte paul_rearpink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x04,0x30,0x0c,0x0c,0x30,0x07,0xe0,0x30,0x0c,0x20,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rearred[] PROGMEM = {16,16,
0x02,0x40,0x14,0x28,0x02,0x40,0x25,0xa4,0x08,0x10,0x12,0x48,0x04,0x20,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

///////paul_rear_walk1

const byte paul_rearw1black[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x02,0x40,0x02,0x30,0x0e,0x3c,0x1a,0x49,0x9c,0x4e,0x78,0x33,0xe8,0x0e,0x88,0x0e,0x10,0x00,0x10,0x00,0x70};

const byte paul_rearw1blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x60,0x01,0x80,0x0c,0x00,0x00,0x60,0x00,0x60,0x00,0x60,0x00,0x00};

const byte paul_rearw1brown[] PROGMEM = {16,16,
0x0d,0xb0,0x0b,0xd0,0x1d,0xb8,0x1a,0x58,0x37,0xec,0x0d,0xb0,0x0b,0xd0,0x02,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rearw1grey[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rearw1pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x04,0x30,0x0c,0x0c,0x30,0x03,0xe4,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rearw1red[] PROGMEM = {16,16,
0x02,0x40,0x14,0x28,0x02,0x40,0x25,0xa4,0x08,0x10,0x12,0x48,0x04,0x20,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

///////paul_rear_walk2

const byte paul_rearw2black[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x02,0x40,0x02,0x70,0x0c,0x58,0x1c,0x39,0x92,0x1e,0x72,0x17,0x4c,0x11,0x70,0x08,0x70,0x08,0x00,0x0e,0x00};

const byte paul_rearw2blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x60,0x01,0x80,0x00,0x30,0x06,0x00,0x06,0x00,0x06,0x00,0x00,0x00};

const byte paul_rearw2brown[] PROGMEM = {16,16,
0x0d,0xb0,0x0b,0xd0,0x1d,0xb8,0x1a,0x58,0x37,0xec,0x0d,0xb0,0x0b,0xd0,0x02,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rearw2grey[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rearw2pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x04,0x30,0x0c,0x0c,0x30,0x27,0xc,0x00,0x0c,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rearw2red[] PROGMEM = {16,16,
0x02,0x40,0x14,0x28,0x02,0x40,0x25,0xa4,0x08,0x10,0x12,0x48,0x04,0x20,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

////////paul_right

const byte paul_rightblack[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x28,0x00,0x08,0x00,0x08,0x06,0x10,0x07,0xe0,0x04,0x00,0x04,0xc0,0x07,0x20,0x04,0x20,0x03,0x80,0x03,0xc0};

const byte paul_rightblue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00};

const byte paul_rightbrown[] PROGMEM = {16,16,
0x1b,0x70,0x15,0xb0,0x2e,0xd8,0x37,0x7c,0x1b,0x80,0x2d,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rightgrey[] PROGMEM = {16,16,
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,0x80,0x03,0x80,0x00,0x00,0x00,0x00};

const byte paul_rightpink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0xd0,0x06,0xd0,0x07,0xf0,0x01,0xe0,0x00,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rightred[] PROGMEM = {16,16,
0x04,0x80,0x2a,0x48,0x11,0x24,0x08,0x80,0x24,0x00,0x12,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

////////paul_right_walk

const byte paul_rightwblack[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x28,0x00,0x08,0x00,0x08,0x06,0x10,0x07,0x20,0x19,0xf8,0x29,0x24,0x27,0xc8,0x22,0x48,0x24,0x40,0x18,0x70};

const byte paul_rightwblue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x10,0x18,0x18,0x10,0x1c,0x30,0x18,0x30,0x00,0x00};

const byte paul_rightwbrown[] PROGMEM = {16,16,
0x17,0x70,0x1b,0xb0,0x2d,0xd8,0x36,0xfc,0x1b,0x80,0x2d,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rightwgrey[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rightwpink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0xd0,0x06,0xd0,0x07,0xf0,0x01,0xe0,0x00,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

const byte paul_rightwred[] PROGMEM = {16,16,
0x08,0x80,0x24,0x48,0x12,0x24,0x09,0x00,0x24,0x00,0x12,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const byte rock_black[] PROGMEM = {16,16,
B00010101,B10110100,B00001101,B10001110,B00001101,B10001101,B00001101,B10000101,B00001001,B10000101,B00001001,B10000001,B00001001,B10000110,B00001011,B00000010,B00001001,B10000001,B00011001,B10000001,B00111011,B10000011,B00100011,B11000010,B01000001,B10000010,B01000001,B10000010,B00000001,B11000111,B10000001,B10100110};

const byte rock_beige[] PROGMEM = {16,16,
B00001000,B00001000,B00000010,B00000001,B00000010,B00000000,B10000010,B00000000,B10000100,B00000000,B00000100,B00000000,B00000100,B00011001,B00000100,B00100001,B00000100,B00100000,B00000100,B00010000,B10000100,B00100000,B10011100,B00000001,B00100000,B01000001,B00100000,B01000001,B01000000,B00000000,B01010010,B0011001};

const byte rock_brown[] PROGMEM = {16,16,
B11100010,B01000011,B11110000,B01110000,B11110000,B01110010,B01110000,B01111010,B01110010,B01111010,B11110010,B01111110,B11110010,B01100000,B11110010,B01011100,B11110010,B01011110,B11100010,B01011110,B01000000,B01011100,B01000000,B00111100,B10011110,B00111100,B10011110,B00111100,B10111110,B00111000,B00101100,B01000000};

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const byte sand_brown[] PROGMEM = {16,16,
B00010001,B00010001,B00000000,B00000000,B10001000,B10001000,B00000000,B00000000,B00010001,B00010001,B00000000,B00000000,B10001000,B10001000,B00000000,B00000000,B00010001,B00010001,B00000000,B00000000,B10001000,B10001000,B00000000,B00000000,B00010001,B00010001,B00000000,B00000000,B10001000,B10001000,B00000000,B00000000};

const byte sand_beige[] PROGMEM = {16,16,
B11101110,B11101110,B11111111,B11111111,B01110111,B01110111,B11111111,B11111111,B11101110,B11101110,B11111111,B11111111,B01110111,B01110111,B11111111,B11111111,B11101110,B11101110,B11111111,B11111111,B01110111,B01110111,B11111111,B11111111,B11101110,B11101110,B11111111,B11111111,B01110111,B01110111,B11111111,B11111111};

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const byte blank_tile1[] PROGMEM = {16,16,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000};

const byte blank_tile2[] PROGMEM = {16,16,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000};

const byte blank_tile3[] PROGMEM = {16,16,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000};



const byte *spritesheet1[] PROGMEM = {blank_tile1,rock_black,};

const byte *spritesheet2[] PROGMEM = {blank_tile2, rock_brown, sand_brown,};

const byte *spritesheet3[] PROGMEM = {blank_tile3, rock_beige, sand_beige,};

///black
const byte tilemap_black[] PROGMEM = {17,29,
16,16,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,
0,0,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};

///brown
const byte tilemap_brown[] PROGMEM = {17,29,
16,16,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,
1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
1,1,1,1,1,1,1,1,2,2,2,2,2,2,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,
1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,};

///beige
const byte tilemap_beige[] PROGMEM = {17,29,
16,16,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,
1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,1,1,1,1,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,
1,1,1,1,1,1,1,1,2,2,2,2,2,2,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,
1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,};



void setup() {
  Serial.begin(921600);
  long unsigned debug_start = millis();
  while (!Serial && (millis() < 4000)) ;
tft.begin();
//   tft.titleScreen(F("Dune esp demo"));
tft.setFrameRate(62);
tft.persistence = false;
tft.setRotation(1);
tft.fillScreen(BLACK);

tft.drawTilemap(x, y, tilemap_black, spritesheet1, BLACK);
tft.drawTilemap(x, y, tilemap_brown, spritesheet2, BROWN);
tft.drawTilemap(x, y, tilemap_beige, spritesheet3, LIGHTBROWN);

}

//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////

void loop(void) {
//updates the GameRIot (the display, the sound, the buttons, everyyhing)
//returns true when it's time to render a new frame (20 times/second)
 if(tft.updateAll()){
  if (tft.buttons.repeat(BTN_RIGHT,1));//{X--:}
  if (tft.buttons.repeat(BTN_LEFT,1));//{X++:}
  if (tft.buttons.repeat(BTN_DOWN,1));//{Y--:}
  if (tft.buttons.repeat(BTN_UP,1));//{Y--:}


///tft.drawTilemap(x, y, tilemap_black, spritesheet1, BLACK);
////  tft.drawTilemap(x, y, tilemap_brown, spritesheet2, BROWN);
////   tft.drawTilemap(x, y, tilemap_beige, spritesheet3, LIGHTBROWN);

  if (tft.buttons.repeat(BTN_UP,1)){
     tft.drawBitmap1(player_x, player_y,paul_rearblack,16,16,BLACK);
       tft.drawBitmap1(player_x, player_y,paul_rearblue,16,16,BLUE);
        tft.drawBitmap1(player_x, player_y,paul_rearbrown,16,16,BROWN);
        tft.drawBitmap1(player_x, player_y,paul_reargrey,16,16,GREY);
         tft.drawBitmap1(player_x, player_y,paul_rearpink,16,16,PINK);
          tft.drawBitmap1(player_x, player_y,paul_rearred,16,16,YELLOW);

          player_direction = 1;
           player_y = player_y - 1;}
          if(player_y <= 0){
            player_y = 0;}

     if (tft.buttons.repeat(BTN_DOWN,1)){
      tft.drawBitmap1(player_x, player_y,paul_frontblack,16,16,BLACK);
       tft.drawBitmap1(player_x, player_y,paul_frontblue,16,16,BLUE);
        tft.drawBitmap1(player_x, player_y,paul_frontbrown,16,16,BROWN);
        tft.drawBitmap1(player_x, player_y,paul_frontgrey,16,16,GREY);
        tft.drawBitmap1(player_x, player_y,paul_frontgreen,16,16,GREEN);
         tft.drawBitmap1(player_x, player_y,paul_frontpink,16,16,PINK);
          tft.drawBitmap1(player_x, player_y,paul_frontred,16,16,RED);

          player_direction = 2;
           player_y = player_y + 1;}
          if(player_y <= 40){
            player_y = 40;}

     if (tft.buttons.repeat(BTN_LEFT,1)){
      tft.drawBitmap1(player_x, player_y,paul_leftblack,16,16,BLACK);
       tft.drawBitmap1(player_x, player_y,paul_leftblue,16,16,BLUE);
        tft.drawBitmap1(player_x, player_y,paul_leftbrown,16,16,BROWN);
        tft.drawBitmap1(player_x, player_y,paul_leftgreen,16,16,GREEN);
        tft.drawBitmap1(player_x, player_y,paul_leftgrey,16,16,GREY);
         tft.drawBitmap1(player_x, player_y,paul_leftpink,16,16,PINK);
          tft.drawBitmap1(player_x, player_y,paul_leftred,16,16,RED);

          player_direction = 3;
           player_x = player_x - 1;}
          if(player_x <= -2){
            player_x = -2;}

      if (tft.buttons.repeat(BTN_RIGHT,1)){
      tft.drawBitmap1(player_x, player_y,paul_rightblack,16,16,BLACK);
       tft.drawBitmap1(player_x, player_y,paul_rightblue,16,16,BLUE);
        tft.drawBitmap1(player_x, player_y,paul_rightbrown,16,16,BROWN);
        tft.drawBitmap1(player_x, player_y,paul_rightbrown,16,16,GREY);
         tft.drawBitmap1(player_x, player_y,paul_rightpink,16,16,PINK);
          tft.drawBitmap1(player_x, player_y,paul_rightred,16,16,RED);

          player_direction = 3;
          player_x = player_x - 1;}
         if(player_x <= -2){
            player_x = -2;}

     /////////////////PLAYER DIRECTION/////////////////

      if (player_direction == 1){
        tft.drawBitmap1(player_x, player_y,paul_rearblack,16,16,BLACK);
       tft.drawBitmap1(player_x, player_y,paul_rearblue,16,16,BLUE);
        tft.drawBitmap1(player_x, player_y,paul_rearbrown,16,16,BROWN);
        tft.drawBitmap1(player_x, player_y,paul_reargrey,16,16,GREY);
         tft.drawBitmap1(player_x, player_y,paul_rearpink,16,16,PINK);
          tft.drawBitmap1(player_x, player_y,paul_rearred,16,16,YELLOW);

     }

    else if (player_direction == 2){
       tft.drawBitmap1(player_x, player_y,paul_frontblack,16,16,BLACK);
       tft.drawBitmap1(player_x, player_y,paul_frontblue,16,16,BLUE);
        tft.drawBitmap1(player_x, player_y,paul_frontbrown,16,16,BROWN);
        tft.drawBitmap1(player_x, player_y,paul_frontgrey,16,16,GREY);
        tft.drawBitmap1(player_x, player_y,paul_frontgreen,16,16,GREEN);
         tft.drawBitmap1(player_x, player_y,paul_frontpink,16,16,PINK);
          tft.drawBitmap1(player_x, player_y,paul_frontred,16,16,RED);

            }


     else if (player_direction == 3){
       tft.drawBitmap1(player_x, player_y,paul_leftblack,16,16,BLACK);
       tft.drawBitmap1(player_x, player_y,paul_leftblue,16,16,BLUE);
        tft.drawBitmap1(player_x, player_y,paul_leftbrown,16,16,BROWN);
        tft.drawBitmap1(player_x, player_y,paul_leftgreen,16,16,GREEN);
        tft.drawBitmap1(player_x, player_y,paul_leftgrey,16,16,GREY);
         tft.drawBitmap1(player_x, player_y,paul_leftpink,16,16,PINK);
          tft.drawBitmap1(player_x, player_y,paul_leftred,16,16,RED);

          }


      else if (player_direction == 4){
        tft.drawBitmap1(player_x, player_y,paul_rightblack,16,16,BLACK);
       tft.drawBitmap1(player_x, player_y,paul_rightblue,16,16,BLUE);
        tft.drawBitmap1(player_x, player_y,paul_rightbrown,16,16,BROWN);
        tft.drawBitmap1(player_x, player_y,paul_rightbrown,16,16,GREY);
         tft.drawBitmap1(player_x, player_y,paul_rightpink,16,16,PINK);
          tft.drawBitmap1(player_x, player_y,paul_rightred,16,16,RED);

             }

         
     }
}



what I'm most curious about are these parts with in the function. I don't understand what the +number does
Code: Select all
uint32_t tilemap_width = pgm_read_byte(tilemap);
   uint32_t tilemap_height = pgm_read_byte(tilemap + 1);
   uint32_t tile_width = pgm_read_byte(tilemap + 2);
   uint32_t tile_height = pgm_read_byte(tilemap + 3);
   tilemap += 4; // now the first tiyleis at tilemap



Image

and I'm including the esp library as well


And i apolagize for being so defensive.

edit:::::

ok so I went back to my first thread where you and sorunome taught me the basics of the gamebuino library. IE programming sprites and game map making. and I found this lil Gem( thank you for this!!!).

Code: Select all
const byte sprite1[] PROGMEM = {16,16,<blahblah blha your sprite data>};

// how many different sprites you have
#define NUM_SPRITES 42
const byte* sprites[NUM_SPRITES] = {
    sprite1,
    /* you should know that part by now :3 */
};

#define WORLD_W 16
#define WORLD_H 16
const byte world[WORLD_W*WORLD_H] PROGMEM = {
  0,1,2,3, /* this should be rather clear, too */
};

int camera_x = 0;
int camera_y = 0;

void drawMap() {
  gb.display.setColor(BLACK); // make sure we draw black, ufo-race apparently drawed inverted sprites
  for(byte y = 0;y < WORLD_H; y++){ // we iterate over the y-coordinate so that we catch every tile in the tilemap
    for(byte x = 0;x < WORLD_W; x++){ // same we also need to iterate over the x-coordinate
      byte spriteId = pgm_read_byte(world + y*WOLRD_W + x); // we fetch the sprite ID from the world, pgm_read_byte because it is in PROGMEM, then the world-pointer needs to be increased by the x-position and for the y-position it needs to be increased y-times how wide the map is to get to the next row
      int x_screen = x*16 - camera_x; // we need to multiply with 16 as a sprite is 16 pixels wide, so we take the current x-iterator which gives us the x-position in the tilemap and then re-calculate that into pixel positions. The camera_x is only there for some global camera position thingy (which part of the tilemap to display)
      int y_screen = y*16 - camera_y; // same but because sprite is 16 pixels tall
      gb.display.drawBitmap(x_screen, y_screen, sprites[spriteId]); // we draw the sprite, sprites[spriteId] gives us the pointer to where the sprite actually is
    }
  }
}


heres my question....... if I'm trying to display multiple bitmaps at once, say one beige one brown one black, when I do the numsprites. How do I do that part for multiple sprite sheets.

Edit::::::

Ok when I try the tilemap ram example above in my sketch doing one color(brown) And it still cuts five tile rows off the right side.

Also having a weird issue with the player movement. When ever I hit a direction button say like up, up goes diagonal upwards left. Down goes down left go left right does nothing!
Attachments
GameRIot_ESP.zip
(28.09 KiB) Downloaded 208 times
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Re: TilemapRamino example

Postby awesome101 » Sat May 27, 2017 7:32 pm

Can you provide the tft.drawTilemap() function source
Edit: I also noticed that when tilemap_black is defined you set the width to 17 and the heigh to 29 even though it should be the width is 29 and the height is 17
awesome101
 
Posts: 159
Joined: Sat Jun 20, 2015 6:56 pm

Re: TilemapRamino example

Postby awesome101 » Sat May 27, 2017 8:24 pm

Try swapping the width and the height I think that should fix it
awesome101
 
Posts: 159
Joined: Sat Jun 20, 2015 6:56 pm

Re: TilemapRamino example

Postby awesome101 » Sat May 27, 2017 8:39 pm

The maximum display resolution of the ILI9341 is 320*240 so I don't understand why you made the tilemap size 29*17 with each tile being 16x16. The map size should be 20x15, so change the map size in black_tilemap.

Also can you post the tft.drawTilemap() function because there could be a problem there too
awesome101
 
Posts: 159
Joined: Sat Jun 20, 2015 6:56 pm

Re: TilemapRamino example

Postby Duhjoker » Sat May 27, 2017 9:14 pm

sorry I took so long. had to bring everything back up.......

ok the 17,29 was like that because i was messing around with different rotations in code including the standard rotation functions to see if that would give me more tiles. It was a suggestion. the reason I added more tile rows was to try and see if there was ome kinda offset that ii was missing but it still should print everytile with the remainder being off screen and scrolling my player sprite to bring the bitmaps out of screen to vision on the screen. it should work just like the gamebuino version.

ok here is the code that I originally transplanted and updated to color. As it is below you will only get about a quarter of the tilemap. Now if you change the int8_t in the tilemap variables and in the function definition to int16_t and it gives me me everything but the last five vertical collumns.,



Code: Select all
  void        drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color);
   void        drawBitmap(int8_t x, int8_t y, int8_t w, int8_t h, const uint8_t *bitmap, uint8_t dx, uint8_t dy, uint8_t dw, uint8_t dh, uint16_t color);
   boolean     getBitmapPixel(const uint8_t* bitmap, uint8_t x, uint8_t y);

   void        drawTilemap(int x, int y, const uint8_t *tilemap, const uint8_t **spritesheet, uint16_t color);
   void        drawTilemap(int x, int y, const uint8_t *tilemap, const uint8_t **spritesheet, uint8_t dx, uint8_t dy, uint8_t dw, uint8_t dh, uint16_t color);

   typedef struct {       //line 171 "Public Variables   - ADD by Summoner123
      int x;                    //X coordinate                 - ADD by Summoner123
      int y;                    //Y coordinate                 - ADD by Summoner123
      const byte *spritecol;    //Sprite of object             - ADD by Summoner123
   }object;
   object solid[60];         // Matriz were saved a Sprite, X and Y cordinates of all tiles on the screen - ADD by Summoner123

   byte numcolision = 0;     //count of solid objects indacat how many tiles drawed on the screen - ADD by Summoner123

   bool flagcollision = true;

////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
//////////////-----------------------------Collision--------------------------//////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////

   boolean collidePointRect(int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t w, int16_t h);
   boolean collideRectRect(int16_t x1, int16_t y1, int16_t w1, int16_t h1, int16_t x2, int16_t y2, int16_t w2, int16_t h2);
   boolean collideBitmapBitmap(int16_t x1, int16_t y1, const uint8_t* b1, int16_t x2, int16_t y2, const uint8_t* b2);



.cpp
Code: Select all
void ILI9341_esp::drawBitmap(int8_t x, int8_t y, int8_t w, int8_t h, const uint8_t *bitmap, uint8_t dx, uint8_t dy, uint8_t dw, uint8_t dh, uint16_t color) {
   int8_t i, j, byteWidth = (w + 7) / 8;
   dw += dx;
   dh += dy;
   int8_t largest = 0;
   int8_t largesty = 0;
   for (j = 0; j < h; j++) {
      for (i = 0; i < w; i++) {
         if (pgm_read_byte(bitmap + j * byteWidth + i / 8) & (B10000000 >> (i % 8))) {
            int8_t drawX = x + i;
            int8_t drawY = y + j;

            if (drawX >= dx && drawX < dw && drawY >= dy && drawY < dh){
               drawPixel(drawX, drawY, color);
            }
         }
      }
   }
}

boolean ILI9341_esp::getBitmapPixel(const uint8_t* bitmap, uint8_t x, uint8_t y){
   return pgm_read_byte(bitmap + 2 + y * ((pgm_read_byte(bitmap) + 7) / 8) + (x >> 3)) & (B10000000 >> (x % 8));
}

void ILI9341_esp::drawTilemap(int x, int y, const uint8_t *tilemap, const uint8_t **spritesheet, uint16_t color){
   drawTilemap(x, y, tilemap, spritesheet, 0, 0, ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT, color);
}
void ILI9341_esp::drawTilemap(int x, int y, const uint8_t *tilemap, const uint8_t **spritesheet, uint8_t dx, uint8_t dy, uint8_t dw, uint8_t dh, uint16_t color){
   uint8_t tilemap_width = pgm_read_byte(tilemap);
   uint8_t tilemap_height = pgm_read_byte(tilemap + 1);
   uint8_t tile_width = pgm_read_byte(tilemap + 2);
   uint8_t tile_height = pgm_read_byte(tilemap + 3);
   tilemap += 4; // now the first tiyleis at tilemap
   uint8_t ddw = dw + dx;
   uint8_t ddh = dh + dy;
   uint8_t maxDdx = (dw - x + tile_width - 1) / tile_width;
   uint8_t maxDdy = (dh - y + tile_height - 1) / tile_height;
   if (tilemap_width < maxDdx){
      maxDdx = tilemap_width;
   }
   if (tilemap_height < maxDdy){
      maxDdy = tilemap_height;
   }
   int8_t startDdx = (-x) / tile_width;
   int8_t startDdy = (-y) / tile_height;
   if (startDdx < 0){
      startDdx = 0;
   }
   if (startDdy < 0){
      startDdy = 0;
   }
   if (flagcollision)numcolision = 0;                                 //Line 735 - clear numcolision - ADD by Summoner123

   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], tile_width, tile_height, color );

            if (flagcollision){
               solid[numcolision].x = drawX;                     //Save X coordinate      - ADD by Summoner123
               solid[numcolision].y = drawY;                     //Save Y coordinate      - ADD by Summoner123
               solid[numcolision].spritecol = spritesheet[tile]; //Save Sprite of tile    - ADD by Summoner123
               numcolision++;                                    //Increment numcolision  - ADD by Summoner123
            }
         }
         else{ // we need to draw a partial bitmap
            drawBitmap(drawX, drawY, tile_width, tile_height, spritesheet[tile], dx, dy, dw, dh, color);
         }
      }
   }
}

////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
//////////////-------------------------Collision----------------------//////////////
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
boolean ILI9341_esp::collidePointRect(int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t w, int16_t h){
   if ((x1 >= x2) && (x1<x2 + w))
      if ((y1 >= y2) && (y1<y2 + h))
         return true;
   return false;
}

boolean ILI9341_esp::collideRectRect(int16_t x1, int16_t y1, int16_t w1, int16_t h1, int16_t x2, int16_t y2, int16_t w2, int16_t h2){
   return !(x2 >= x1 + w1 ||
      x2 + w2 <= x1 ||
      y2 >= y1 + h1 ||
      y2 + h2 <= y1);
}

boolean ILI9341_esp::collideBitmapBitmap(int16_t x1, int16_t y1, const uint8_t* b1, int16_t x2, int16_t y2, const uint8_t* b2){
   int16_t w1 = pgm_read_byte(b1);
   int16_t h1 = pgm_read_byte(b1 + 1);
   int16_t w2 = pgm_read_byte(b2);
   int16_t h2 = pgm_read_byte(b2 + 1);

   if (collideRectRect(x1, y1, w1, h1, x2, y2, w2, h2) == false){
      return false;
   }


here is more info........
viewtopic.php?f=12&t=3213
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow

Next

Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 3 guests

cron