I am going back to my isometric game , my question is should I use a vector to store tiling sprites data?
isometric game tiling
here is some of the code I am using.
#include <iostream>
#include <vector>
using namespace std;
class Tile
{
public:
float tile_x;
float tile_y;
float tile_width;
float tile_height;
};
int main()
{
vector<Tile> tiles;
Tile mountain;
Tile castle;
Tile knight;
mountain.tile_x = -140.0f;
mountain.tile_y = 100.0f;
mountain.tile_width = 40.0f;
mountain.tile_height = 20.0f;
tiles.push_back(mountain);
mountain.tile_x = -100.0f;
mountain.tile_y = 100.0f;
mountain.tile_width = 40.0f;
mountain.tile_height = 20.0f;
tiles.push_back(mountain);
return 0;
}
pbivens67 said:
should I use a vector to store tiling sprites data?
A vector is a good solution.
my question is should I use a vector to store tiling sprites data
It's not that you should or should not use a vector. It's that you are free to use a vector.
None
pbivens67 said:
is my code a good start?
Did you write code to display the stored tiles already using the vector?
Alberth said:
Did you write code to display the stored tiles already using the vector?
All you have to do is glance over the ~25 lines of code and see that he didn't. Are you trying to be funny?
I'm sure we'll see #import <GLUT> soon enough.
🙂🙂🙂🙂🙂<←The tone posse, ready for action.
Alberth said:
pbivens67 said:
is my code a good start?Did you write code to display the stored tiles already using the vector?
I am attempting to store the values in a vector
Ok.
To verify you stored the correct numbers, write code to dump the content of the vector.
Build a loop that iterates over the elements of the vector, and for each element, print the values of the (if all is well) stored tile position and size. Then check whether that output matches with your expectations. If it does, then all is indeed well 🙂
Good luck
pbivens67 said:
I am going back to my isometric game , my question is should I use a vector to store tiling sprites data?
Based on the statement that we are dealing with “tiling sprites” we're talking about putting them out as some kind of regularly spaced isometric game grid?