Jump to content
  • Advertisement
Sign in to follow this  
RobN

My first game.

This topic is 4272 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

Here is my first attempt at game programming, written in C++ and SDL tell me what you think !: http://www.libsdl.org/games.php?order=name&category=-1&completed=0&os=-1&match_name=DART&perpage=50

Share this post


Link to post
Share on other sites
Advertisement
I tried the game out. It's pretty hard to stay away from the UFO, is it possible to avoid it at all? :D
Also, the movement gets a little bit anoying when you press two direction buttons at the same time and it doesn't change direction. I like the concept though. :)

Share this post


Link to post
Share on other sites
A good first try! Congratulations. I like the fact that the background was different every game. I had some trouble controlling the frog though: you can't have two arrow keys down at the same time. If you post how you track the keys, and the direction of the frog, I'm sure I can help you, though. I think there should be a delay, or a wait for a key press before you respawn, though. Altogether, pretty good for first try.

Share this post


Link to post
Share on other sites
Yea i realised the turning is buggy and doesnt react well to quick turns which is pretty elemental to the game.

Heres part of the code for changing direction:
The direction property is just used for showing the appropiate sprite.
Velocity is added onto the objects current x,y posistion.
Quote:

case SDLK_LEFT:
frog.stopped = false;
frog.direction = frog.Left;
frog.velocityx = -8;
frog.velocityy = 0;
break;

case SDLK_RIGHT:
frog.stopped = false;
frog.direction = frog.Right;
frog.velocityx = +8;
frog.velocityy = 0;
break;


Heres the code for stopping the frog:
Quote:

case SDL_KEYUP:
{

switch(event.key.keysym.sym)
{


case SDLK_UP:
frog.velocityy = 0;
break;

case SDLK_DOWN:
frog.velocityy = 0;
break;
case SDLK_LEFT:
frog.velocityx = 0;
break;
case SDLK_RIGHT:
frog.velocityx = 0;
break;


}


I think the buggy movement is caused when opposite arrow keys are pressed cancelling each other out and setting velocity to 0 ? any ideas how to get round this ?

Share this post


Link to post
Share on other sites
Ok i fixed the movement bug!
Ive updated the link to the fixed version.
try it now !

Share this post


Link to post
Share on other sites
Quote:
Original post by RobN
Ok i fixed the movement bug!
Ive updated the link to the fixed version.
try it now !


Nice game.

One thing you may want to consider are the little clouds or whatever that cross the screen, when you create them you put them at x = 0, so I can see them being created.

If you created them a x = -imageWidth, they would drift on screen instead, I think this would look better.

Good work.

Share this post


Link to post
Share on other sites
Another update, updated it so the clouds drift on the screen as rip-off recommended and more significantly modified the code so it doesnt use 100% CPU !

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!