• 9
• 11
• 9
• 20
• 12
• entries
686
1952
• views
386906

# Yay! Source code!

74 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?

##### Link to comment
Yeah I'll check this out :-)

##### Link to comment
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.

##### Link to comment
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;
}



##### Link to comment
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 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