• entries
686
1952
• views
386227

Yay! Source code!

58 views

If anyone is interested, here is the source code for Stompy's Revenge. I wasn't going to release it, but than I figured, why not? Hopefully it can be helpful to some, and a good joke for others.[smile]

On Earthman progress, I've gotten up to my tile code rewritten in C++. I'll work on the Entity code tomorrow (err...today).

If I have time, I'll try to port it to Mac OS X. Have you done anything Windows-specific that I should look out for?

Yeah I'll check this out :-)

Quote:
 Original post by Ravuya If I have time, I'll try to port it to Mac OS X. Have you done anything Windows-specific that I should look out for?

No, I don't think I have. All of it just uses the base SDL libraries.

I'm at work, so I just typed this up, but I think it's right. (You'll wanna test it out.)

This improves two things.
1) Pass by const reference, so the program's not making unnecessary copies.
2) Fewer comparisons.

Hope you don't mind me trying to help.

bool Intersect(const SDL_Rect &r1, const SDL_Rect &r2)
{
if((r1.x < r2.x + r2.w) && (r1.x + r1.w > r2.x) &&
(r1.y < r2.y + r2.h) && (r1.y + r1.h > r2.y))
{
return true;
}

return false;
}



Thanks! I'm using the same collision code for my new game, so I'll make sure to change it to that.

Create an account

Register a new account