But I want to use FemtoIDE and Piskel to create graphics!
While browsing the code, you may have noticed that the graphics images used are just the pixel data and do not have embedded dimensions. If you have used FemtoIDE and have created graphics within it, you are probably familiar with its process of converting images into .h files for immediate inclusion into a program.
These image also allow you to render the images using the overloaded method
drawBitmap(x, y, image) where you do not need to specify the dimensions.
If you download the code in the repo https://github.com/filmote/Tilemap_4 you will see how I have used the
image.h files from the FemtoIDE conversion process to populate the tile data. This is done using a helper method of the tilemap class, as shown below.
tilemap.setTile(TileType::Green, Images::Green); tilemap.setTile(TileType::Tree, Images::Tree); tilemap.setTile(TileType::Grass, Images::Grass); tilemap.setTile(TileType::Water, Images::Water); tilemap.setTile(TileType::Brick, Images::Brick); tilemap.setTile(TileType::Door_Open, Images::Door_Open); tilemap.setTile(TileType::Door_Closed, Images::Door_Closed); tilemap.setTile(TileType::Key, Images::Key); tilemap.setTile(TileType::Carpet, Images::Carpet);
Part 1 of 9: Building a Simple Tilemap Game
Part 2 of 9: Moving a Player Around the World
Part 3 of 9: Rendering the Viewport and Player
Part 4 of 9: Detecting Obstacles
Part 5 of 9: Adding Enemies
Part 6 of 9: Using FemtoIDE and Piskel
Part 7 of 9: Doors and Inventory Items
Part 8 of 9: Multiple Worlds
Part 9 of 9: Sixteen Tiles Only?