Help me, Objects and Hit procedures!

Started by
1 comment, last by pixl 22 years, 3 months ago
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
Advertisement
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.
http://www.gamedev.net/reference/articles/article754.asp

Hope that answers your question.

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

This topic is closed to new replies.

Advertisement