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

Published October 25, 2005
Advertisement
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 ;)
0 likes 6 comments

Comments

Patbert
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.
October 25, 2005 07:22 PM
Sir Sapo
Thats cool that you released the code, I always love seeing how someone else writes their stuff.
October 25, 2005 08:58 PM
ApochPiQ
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]
October 26, 2005 01:56 AM
Jesse Chounard
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. :)
October 26, 2005 10:21 AM
Jesse Chounard
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.
October 26, 2005 12:36 PM
Stompy9999
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.
October 26, 2005 06:02 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement