Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - bglaze

Pages: 1 2 3 [4]
46
General / New to C++ and SFML - Hoping to get advice on my code...
« on: October 11, 2011, 05:21:35 am »
Hey folks!

New to the forum, and so far I am loving SFML (though I am not sure if I am utilizing it well, yet).

In order to try to teach myself c++ and SFML, I began a small snake game, and I am hoping some people might be willing to check out the code and let me know what I can do to clean it up so far.

So far it is just the snake's head moving around the screen and dying when it hits the walls.

But I am sure that some of the code could be cleaned up. Especially in my Move_Me() SnakeHead member function such as this line:
this->SetPosition( (game.SW - this->GetImage()->GetWidth()), this->GetPosition().y );

I am wondering if there is an easier way to access my sprite's width, screen width, etc...

Anyway, here is the zip of my Code::Blocks project.

http://bglz.net/files/cpp/projects/Yellow_Snake.zip

My code, though crappy as it probably is, is always free to use, reuse, and distribute at your pleasure!

Thanks!
Brock

Pages: 1 2 3 [4]
anything