Guys, I have a problem with my game. The problem is that I have only one enemy. I can't make more enemies mainly because the SDL_Rect doesn't work as expected. The stuff I did: I made one SDL_Rect called 'enemybox' and I put it in class Enemy along with all other necessary stuff for the Enemy like movement, collision, rendering, etc. I have only one member from class Enemy called 'enemy1'. Ok, I created enemy2, but now I need to somehow change the SDL_Rect coordinates. Ok, after the default constructor, which is Enemy(), I made Enemy( int, int ) constructor.
It goes like this:
Enemy( int a, int b)
{
enemybox.x = a;
enemybox.y = b;
}
Now every time I initialize new enemy, I write it like this: Enemy enemy2( 300, 400) or Enemy enemy3 ( 50, 60) so I can assign the starting coordinates...but the problem is that this doesn't work. It doesnt even show anything on the screen, that means that the constructor is not working. I posted my problem in st*ckoverfl*w but nobody gave me a decent answer for beginner, the best answer was to make some virtual class and somehow inherit some stuff and its very compicated for me.
I just want to make another member of the class, assign him the x, y coordinates and everything is fine. Tell me the easiest way you know, step by step, so I can understand it. I'm struggling with this for 2 weeks and I can't do anything and it really s*cks. Any help is MUCH appreciated, really.