Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


[First SDL game] Care to give some feedback ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 cold_heats_.--.   Members   -  Reputation: 127

Like
0Likes
Like

Posted 06 July 2012 - 12:22 PM

Hello there.After a lot of brainstorming and some unslept nights, I finally managed to make a game that uses a multimedia library Posted Image .
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 ?

Attached Files


Edited by cold_heats_.--., 06 July 2012 - 12:26 PM.


Sponsor:

#2 sednihp   Members   -  Reputation: 241

Like
1Likes
Like

Posted 06 July 2012 - 03:49 PM

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 limitint 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 }}[/source]


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, 06 July 2012 - 03:56 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS