Original Post
Hello,
At the moment i'm trying implement plaforms in my 2d platformer. I want to store the platform data in an array of SDL_Rects. This is what I have:
In my header:
This is how I change the array data:
And for rendering:
The problem seems to occur when I try to run the second code block.
There are no compile errors, only as soon as the game starts it crashes.
Can you help me?
Thanks,
DuckerDuck
At the moment i'm trying implement plaforms in my 2d platformer. I want to store the platform data in an array of SDL_Rects. This is what I have:
In my header:
private:
SDL_Rect rPlatformArray[20];//maximum platforms in a level is 20 (for now)
This is how I change the array data:
if (type == 4){
rPlatformArray[NumberOfPlatforms].x = x;
rPlatformArray[NumberOfPlatforms].y = y;
rPlatformArray[NumberOfPlatforms].h = h;
rPlatformArray[NumberOfPlatforms].w = w;
NumberOfPlatforms++;
}
And for rendering:
for (int i = 0; i <= NumberOfPlatforms;i++){
SDL_FillRect(screen,&rPlatformArray,0xFFFFFF);
}
The problem seems to occur when I try to run the second code block.
There are no compile errors, only as soon as the game starts it crashes.
Can you help me?
Thanks,
DuckerDuck