Sign in to follow this  
RaduIulianGabriel

SDL Simple game - Ball won't move

Recommended Posts

Hello everyone. I started to use SDL libraries one day ago. Currently I'm making my first game and I'm desperately trying to move the ball (using z, x). I applied the same method that I've used for the 2 players (humans wannabe stick drawing) but the ball won't move. What am I doing wrong? Please help. Thanks in advance.

I've attached the game files + codeblocks project.

Share this post


Link to post
Share on other sites
The problem is on line 529
[code]apply_surface(388, 288, ball_sprite, screen);[/code] You need to use ball.x and ball.y instead of fixed positions.


[i]I noticed you have a class named Player and another class named Player2. To me it looks like these two classes work the same way so you could probably do fine with just one Player class.[/i]

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