Making a extremely simple Tile game, tearing my hair out

Hi,

I've been trying to make a tile game using C++ for the past week. I thought that I could follow a game making tutorial using SDL2 on youtube, cannibalize the code and make it fit my needs. I was very wrong. Right now, all I want is god damn working prototype.

My game is such:

Window opens and there is a two by two grid. (Making a window, setting the background, easy peasy, done).
After five seconds, in a RANDOM square on the grid, a image appears. If you click it, it disappears. If you don't, after 5 seconds another RANDOMLY selected square has an image appear on it and so on. You have to make sure that the grid does not fill up, if it does, the window should close.

The images that appear on a grid square are supposed to be randomized as well as either a triangle, circle or square.



Should I not be using SDL2 for this? Every tutorial I follow online is using it to animate sprites using a spritesheet, but for the life of me I cannot figure out how to change the code to suit my needs.

Right now, as soon as the window opens, I can have a random shape appear on each grid square. But as soon as I start to put the logic for randomizing the grid square selection in my game loop, it all goes to hell. It seems that after following the tutorial, my code is more suitable for having a character that is animated using a spritesheet that can be moved around the window using the keyboard.

Looking for any guidance...
SDL2 should be fine for what you're trying to do. Note that Tutorials are meant for studying and learning from. Just taking the code and changing it without understanding how it works will probably lead to a lot of bugs and will not take you very far. If the tutorial program is very different from your own program you might have to do some fundamental changes to the code, and it might even be better to start from scratch.
Topic archived. No new replies allowed.