Jump to content
  • Advertisement
Sign in to follow this  
RaduIulianGabriel

SDL Simple game - Ball won't move

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

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
Advertisement
The problem is on line 529
apply_surface(388, 288, ball_sprite, screen); You need to use ball.x and ball.y instead of fixed positions.


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.

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!