Sign in to follow this  

[First SDL game] Care to give some feedback ?

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 [img][/img] .
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this