-Snip- 1:1: indeed, this is only the solution until Texture and sprites are added later, it is simply because it is faster to set up :)
Rendering many rectangles to display a level of tiles can be highly ineffecient.
-Snip- 2:
You will almost certainly benefit from using a vertex array (or equivalent)
-Snip- 3:
Are you still drawing multiple rectangle shapes?
-Snip- 1:1: yes, i know, and do.. that was what i meant by (flat) 3d array. not sure what else to call it? my arrow looks like so:
3D array? You can store these sorts of levels in a 1D array
-Snip- 2:
As for that third dimension, you can use a single integer value to represent if something exists and which type if it does by using a single value (maybe zero?)
_xSize = _levelImg.getSize().x;
_ySize = _levelImg.getSize().y;
int size = _xSize * _ySize * _depth;
_tiles = new int[size];
for (int i = 0; i < _ySize; i++) {
for (int k = 0; k < _xSize; k++) {
int Tile = 0;
if (_levelImg.getPixel(k, i) == sf::Color(0, 0, 0)) Tile = 1;
//Tile can later be 2,3... for sloops, edges... and so one
_tiles[(k * _depth) + (i * _xSize * 2) + 0] = Tile;
//the tile set i've drawn have 3 versions of each tile, so determining a random number to make it more seemless
_tiles[(k * _depth) + (i * _xSize * 2) + 1] = rand() % 3;
}
}
@Mortal
Thank you,
@Mortal
i do what i can, when i can. Mostly i don't work much on code, but that day i had a lot of time, so a lot was done :)
ps. does anyone have a good suggestion for a screen capture program, the one i use lag even at 8% cpu usage (3% for the game, 3% for the cam program 2% for mics others), so not wort much :S (frame rate set between 30 and 60, all lag :S
Next update is here:
1: I've added ladders to the terrain, as i figured their use is heavily tied to my terrain hitTest.
2: Fixed the fall down bug, so items no longer gets embedded into the ground or the walls.
3: added a "head" hitTest, so that you cannot jump up trough the ceiling.
4: added a "auto center" function to ladder
5: again removed a lot of double code
6: added a "focus rectangle" to the character image area on the left, showing what character is active
7: added individual mana and hp to each character (randomized for now)
I think that is is.. next up, textures :D
ps. does anyone have a good suggestion for a screen capture program, the one i use lag even at 8% cpu usage (3% for the game, 3% for the cam program 2% for mics others), so not wort much :S (frame rate set between 30 and 60, all lag :SI suggest to use OBS Studio and switch to FFMPEG recording. When you use the standard x264 recording, your CPU will encode the video material in real-time which is quite demanding. When you use ffmpeg to record, you can switch to ffv1 or lagarith codec (make sure to switch to YVU mode), which will have very little impact on the CPU, but since they are lossless formats, will generate huge files.