Jump to content
  • Advertisement
Sign in to follow this  

[First SDL game] Care to give some feedback ?

This topic is 2203 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello there.After a lot of brainstorming and some unslept nights, I finally managed to make a game that uses a multimedia library biggrin.png .
The gameplay is very simple and straight forward : all the player has to do is fill the screen with circles, untill the total covered area passes a limit.

This one is the third project.The first project is about testing SDL, the second one is the "brute " game and the third one has menus in it .
The "brute" game was actually easy to make, and I finished it quickly.The hard part was implementing it as a FSM, because I wanted to add menus and stuff.It's not final yet . I tried to keep the code as clean as I can.
You have to press "Enter" during menus.
I want to add a time limit for each level , but I have no idea how to do that .

Anyway, opinions ? Edited by cold_heats_.--.

Share this post

Link to post
Share on other sites
To set a time limit, whenever the main level starts, assign SDL_GetTicks() to a variable, then at the end of each frame, check if the current time minus the start time is bigger than the time limit. i.e.

[source lang="cpp"]const int levelTimeLimit = 30000 //30s time limit
int startTime = SDL_GetTicks()

while(game is running)
//insert game loop code here

if(SDL_GetTicks() - startTime > levelTimeLimit) //check the current time vs the time limit
//exit level code goes here

The game seemed to work perfectly well from my quick trial, I like the idea behind it and the animations were pretty nice, but trying to read the code gave me a headache. Try to format your code nicely with proper indenting (like my example code above) to make it easier to read and understand for others. You might want to look into object oriented code as well, it'll make things easier for you in the long run when your games get bigger. If you want an idea I've got a few SDL games and their sourcecode at the link in my signature. Edited by sednihp

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!