Original Post
Hey everyone,
A few days ago I started my first attempt to do a "proper" game, and i decided to do a platformer. I had previously done some simple ones such as tic tac toe and duckhunt. I used SDL for the graphics.
So i started by creating an object class, and then some class's who inherit from that one, so that can move, or so that they only use part of the surface image, etc.
One of those class's is a Tile class, and that's where im having trouble. The class itself works fine, but when i try to create an array of that class, it just simply doesn't work. and the sdl window goes into a strange state.
The i tried it in 3 different ways. First was with pointer like so:
Second method was same but without the pointers, just using a fix size array. Didn't work either. I get no error's and the warning's aren't related to it either. I also tryed it with new Tile(...).
I'm probably just doing something terribly wrong and stupid but i hope u guys can help me find it.
Also i know the tile class itself works coz when i try to run a single one without the array it works just fine.
I hope im not posting this in the wrong place, i know there's an sdl dedicated area, but as this is more of a problem with the class itself i decided not to post there.
I also added the code in case it's needed(keep in mind im still a newbie);
A few days ago I started my first attempt to do a "proper" game, and i decided to do a platformer. I had previously done some simple ones such as tic tac toe and duckhunt. I used SDL for the graphics.
So i started by creating an object class, and then some class's who inherit from that one, so that can move, or so that they only use part of the surface image, etc.
One of those class's is a Tile class, and that's where im having trouble. The class itself works fine, but when i try to create an array of that class, it just simply doesn't work. and the sdl window goes into a strange state.
The i tried it in 3 different ways. First was with pointer like so:
Tile *lTiles;
lTiles = new Tile[size];
for(int i = 0; i < size; i++)
{
lTile = Tile(...);
}Second method was same but without the pointers, just using a fix size array. Didn't work either. I get no error's and the warning's aren't related to it either. I also tryed it with new Tile(...).
I'm probably just doing something terribly wrong and stupid but i hope u guys can help me find it.
Also i know the tile class itself works coz when i try to run a single one without the array it works just fine.
I hope im not posting this in the wrong place, i know there's an sdl dedicated area, but as this is more of a problem with the class itself i decided not to post there.
I also added the code in case it's needed(keep in mind im still a newbie);