Pixel art is time consuming
4,453
3
Advertisement
Art is tough:
Pixel art is very hard in my opinion. I have no patience for it and I really suck at it. I might need to work with a pixel artist and I never worked with an artist before. I hope I can work with one in the future.
Code chat:
Enough crying about art. Let me explain my tile engine. The tile engine is using std::ifstream("test.Worldmap"); and I'm using std::array map; to store the tiles. The std::array will store SDL_Rect types and total_tiles is the number of tiles on the map. I used a struct that can hold values of the tiles. In addition, the std::ifstream("test.Worldmap"); will search for the type of tile on the map with speacial characters: "1"(grass), "3"(water), "p"(Player), and "2"(wall). I used a switch() statement for this procedure.
For example:
p 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 2 1 1 1
1 1 2 2 2 1 1
1 1 2 2 2 1 1
1 1 3 3 3 1 1
1 1 1 1 1 1 1
To calculate the total_tiles, just use basic math. 7 X 7 = 49. You can use two for loops to make this work, but I only used one for loop to fill the tiles in std::array. Would be nice if I posted some code, right? Pshh, there's hundreds of tutorials on this so anyone can find them online. My code was based on a tutorial from a java tutorial game website. However, I decided to only take the read file example and change it to my satisfaction. In the end, I did learn a lot from the java tutorial. BTW, std::array is a C++11 library.
Anymore stuff to mention?:
My collision and character movement works. Therefore, I have a working game engine made with SDL. All is left for me to do is design a game mechanism and create a good idea for games. This is only the beginning of the difficult journey. Stay tuned.
Pixel art is very hard in my opinion. I have no patience for it and I really suck at it. I might need to work with a pixel artist and I never worked with an artist before. I hope I can work with one in the future.
Code chat:
Enough crying about art. Let me explain my tile engine. The tile engine is using std::ifstream("test.Worldmap"); and I'm using std::array map; to store the tiles. The std::array will store SDL_Rect types and total_tiles is the number of tiles on the map. I used a struct that can hold values of the tiles. In addition, the std::ifstream("test.Worldmap"); will search for the type of tile on the map with speacial characters: "1"(grass), "3"(water), "p"(Player), and "2"(wall). I used a switch() statement for this procedure.
For example:
p 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 2 1 1 1
1 1 2 2 2 1 1
1 1 2 2 2 1 1
1 1 3 3 3 1 1
1 1 1 1 1 1 1
To calculate the total_tiles, just use basic math. 7 X 7 = 49. You can use two for loops to make this work, but I only used one for loop to fill the tiles in std::array. Would be nice if I posted some code, right? Pshh, there's hundreds of tutorials on this so anyone can find them online. My code was based on a tutorial from a java tutorial game website. However, I decided to only take the read file example and change it to my satisfaction. In the end, I did learn a lot from the java tutorial. BTW, std::array is a C++11 library.
Anymore stuff to mention?:
My collision and character movement works. Therefore, I have a working game engine made with SDL. All is left for me to do is design a game mechanism and create a good idea for games. This is only the beginning of the difficult journey. Stay tuned.
Advertisement
Advertisement
Advertisement
Discussion