At least it works...

Published September 27, 2005
Advertisement
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 mapvoid 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:                      break;                 case 1:                      SDL_BlitSurface(grass, NULL, screen, &rect);                      break;                 case 2:                      SDL_BlitSurface(brick, NULL, screen, &rect);                      break;             }         }     }     }


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.
Previous Entry Blocky Man!
Next Entry The Anti-blocky!
0 likes 6 comments

Comments

H_o_p_s
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?
September 27, 2005 07:57 PM
Jesse Chounard
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. :)
September 27, 2005 08:22 PM
Rob Loach
Good job! I love the programmer art!
September 27, 2005 09:44 PM
H_o_p_s
Quote:Rob Loach
Good job! I love the programmer art!
Thats always the best part of his games [grin]
September 27, 2005 11:37 PM
Stompy9999
Quote:That's always the best part of his games![grin]


I don't know whether to be offended or flattered.[smile]
September 28, 2005 06:58 AM
H_o_p_s
You should be flattered.
September 28, 2005 04:59 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement