Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Help me, Objects and Hit procedures!

This topic is 6004 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

Haya! I have some techniques issues I''d like to get some help with. I''m coding a 16-bit platform game in C under Win9x using a Borland compilator. It''s in mode13. Now, I would be glad if someone could give me a piece of advice on how to make my "player object" know when he runs into an object or a wall. I''m currently using the dubbel-buffering technique and to verify wether there is an object under the "player objects" feet I check for the color in the 320*200 byte sized buffer. If the color differs from the "ground object" color, he should fall. I''m not sure wether this is a healthy way or not to do it because I''ve seen that in several platform games, ie. "Super Mario Brows 1", when the "player object" stands on the very edge of a cliff or ie. mushroom like in SMB, it tends to stay in the air till the mushroom or the cliff ends vertically. Also when it hits a wall it seems like the "player obj" apprehends this object just by the coords! So, I''ve thought of using a second buffer at the size of 320*200 bytes that holds all the coords of invisible objects that I declare by setting those coords to 1s and all other to 0s, and then use a hit algorithm based upon that buffer so that when the "player obj" encounters that coords pos it will react. Then I will just place all visible objects at those locations. This is just an idea I''ve come up with, but I''m not sure if this is the right/common technique to use, and I dont want to waste time on coding procedures that are for no use, so plz just give me some hints and advices would you ? Thnx alot. c.wenner@telia.com

Share this post

Link to post
Share on other sites
Good ol'' TANSTAAFL had an old article here on GameDev.net about the kind of stuff you''re talking about using bitmasks to compare if one object overlaps another. You''ll have to interpret it a bit in order to apply to what you mentioned in your post.

The only thing I''ll add to it is that if your player object is moving too fast per update (frame), it may actually go through other objects. So my advice is to check if your player object hit anything between updates.

Hope that answers your question.

P.S. By the way, there''s really no right/common technique to use. If it works, it works.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!