Jump to content
Sign in to follow this  
  • entries
  • comments
  • views

At least it works...

Sign in to follow this  


Alot of you pointed out how I shouldn't be using a giant bitmap for scrolling. As such, I already fixed it. This took all but 10 minutes to complete, and makes the game look smoother during play.

The code for Blocky Man so far is so much cleaner than any game code I have ever written. It didn't take long for me to get the Tilemap drawing routine in there:

// Draw Tile map
void DrawMap()
SDL_Rect rect_bg;

rect_bg.x = 0;
rect_bg.y = 0;

SDL_BlitSurface(bg, NULL, screen, &rect_bg);

int map_x = map.getScroll() / 32;

for(int i = 0; i < 15; i++)
for(int c = map_x; c < map_x + 21; c++)
SDL_Rect rect;
rect.x = c * 32 - map.getScroll();
rect.y = i * 32;

switch(map.getTile(c, i))
case 0:
case 1:
SDL_BlitSurface(grass, NULL, screen, &rect);
case 2:
SDL_BlitSurface(brick, NULL, screen, &rect);


Believe it or not, for me, that it incredibly clean.

I completed an early player class, which has no animation:

At first, it was incredibly buggy, but I've ironed out most of the bugs now. I'm still testing it though, so I can't be certain if it is completely bug free.

The method I'm using for jumping is rather simple. It is something I mentioned awhile ago in these forums. That is, taking into account some of the other posts in that topic. I think it is a good read if you're interested in how to do jumping.

So yeah, I still need to test out this class, but I plan to start working on enemies soon.
Sign in to follow this  


Recommended Comments

Might I suggest that you use define some constants (or what ever you do in C++...) so that eventually when you have a bigger map, or want to change the tile size that it isn't that difficult?

Share this comment

Link to comment
Looks pretty good. Good work on fixing the scrolling.

Setting some constants for tile sizes wouldn't be a bad idea, but instead I'd recommend putting them in your map structure. (That way different games/levels could use the same code and have different tile sizes.) Also, I would make your DrawMap function take the map as a parameter, rather than looking for it as a global variable.

Keep the updates coming. :)

Share this comment

Link to comment
Rob Loach
Good job! I love the programmer art!
Thats always the best part of his games [grin]

Share this comment

Link to comment
That's always the best part of his games![grin]

I don't know whether to be offended or flattered.[smile]

Share this comment

Link to comment

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
  • 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!