• 11
• 9
• 10
• 9
• 10
• entries
686
1952
• views
386917

# If anyone wants to take a look-see...

88 views

I uploaded the source code for Blocky Man.

For the most part it is my usual, uncommented, messy, code. However, the player class and the tile map code are pretty nice. This game was created using Code::Blocks, probably my last game created with a free IDE.

Anyways, download it if you're interested. It's only 9kb ;)

I love the way blocky man continously hops if you hold down the up key. You should make a level where he can't stop jumping.

##### Link to comment
Thats cool that you released the code, I always love seeing how someone else writes their stuff.

##### Link to comment
Damnit... every time I think I'm getting close to finishing my plans for Castle Blockenstein, you go and add more work for me. Now I'm just going to have to do a source mod to make it totally complete.

I'd hate you, but I'm too busy having fun with your code [wink]

##### Link to comment
I was going to add in parallax scrolling of the background for you, but I'm getting a linker error. It seems Enemy::moveLeft (and moveRight) are missing. Was there an Enemy.cpp file that didn't get included, perhaps?

For now I'll stub them out, and have some code for you in a little while. :)

##### Link to comment
Well, that was even easier than I thought. :)

Use this instead of what you've currently got to draw that background. If the background is only 640x480, you'll see no change. If it's bigger (try a 1280x480 image) the background will scroll at a different rate than the rest of the level.

    rect_bg.x = (bg->w - 640) * map.getScroll() / map.getWidth();
if(rect_bg.x + 640 >= bg->w)
{
rect_bg.x = bg->w - 640;
}
rect_bg.y = 0;
rect_bg.w = 640;
rect_bg.h = 480;

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



For some reason my enemies aren't being drawn. I had to disable collisions so I could test this. I think it's probably tied to the missing code I mentioned in the last post, though, so I didn't try to debug it.

##### Link to comment
Try just putting the moveRight and moveLeft in enemy.h. That was where they origionally were, but for some stupid reason I moved them. Anyways, putting them in the header file should fix it.

## 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