Sign in to follow this  

Since games have strict rules...

This topic is 4820 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

...I'm having a hard time seeing how to fit them into the OO paradigm. Here is my problem: I don't see how you can delegate (not literally) actions to different objects, because their actions would have to be bounds-checked. And if they need to be bounds-checked, they need to be bounds-correctable, which would mean friendship. In other words: How can you safely let each object do it's own thing without having to make sure what they do is safe?

Share this post


Link to post
Share on other sites
Let objects know about the things which contain them.

When the objects are 'doing their own thing', have them ask the containing object for permission, if their location changes. It could be as simple as having each ContainerObject provide a "Location ContainerObject.clampToInterior(Location)" method. (Or possibly a void return type, if your Location type is mutable.)

Share this post


Link to post
Share on other sites

This topic is 4820 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this