Sign in to follow this  
RobN

My first game.

Recommended Posts

RobN    100
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
Redien    122
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
NIm    210
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
RobN    100
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
rip-off    10976
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
RobN    100
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

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