About Store Forum Documentation Contact



Post Reply 
Create a tiled-based game.
Author Message
Nontre Offline
Member

Post: #1
Create a tiled-based game.
Hi, I have been fighting with the engine for a week, and I cannot implement a tile system with ImageAtlas or Image. Could you guide me a bit with an example?
I would like to do it through a matrix like this example of sfml:

const int level[] =
{
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3,
0, 1, 0, 0, 2, 0, 3, 3, 3, 0, 1, 1, 1, 0, 0, 0,
0, 1, 1, 0, 3, 3, 3, 0, 0, 0, 1, 1, 1, 2, 0, 0,
0, 0, 1, 0, 3, 0, 2, 2, 0, 0, 1, 1, 1, 1, 2, 0,
2, 0, 1, 0, 3, 0, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1,
0, 0, 1, 0, 3, 2, 2, 2, 0, 0, 0, 0, 1, 1, 1, 1,
};

// create the tilemap from the level definition
TileMap map;
if (!map.load("tileset.png", sf::Vector2u(32, 32), level, 16, 8))
return -1;


Any better idea to implement it?
Thx pfft
07-25-2020 10:20 AM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: Create a tiled-based game.
If you want to create an image, then there's a tutorial for it:
/* Apps\04 - Graphics\Dynamic Image */
07-25-2020 12:52 PM
Find all posts by this user Quote this message in a reply
Post Reply