Jump to content
  • Advertisement
Sign in to follow this  
-justin-

single pt on image detection?

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

Ok guys, I have a character, I want the character to be able to pick up items sort of like in super smash brothers (cept this is 2d). The item needs to stick to the characters hand. Is there anyway to follow a specific point on an image or follow a specific color? Or do I have to hard-code it? I'm using directx for my api. Any links and/or advice would be greatly appreciated!!

Share this post


Link to post
Share on other sites
Advertisement
One method to do this is to use bounding boxes or circles. In your game, you would have a bounding shape for the image that can be picked up. If the player happened to collide with this bounding shape -- this can be done by giving the player a bounding shape and testing for collisions between the two shapes -- then you treat the item as picked up.

To stick the item in the player's hand, I'm thinking that you're going to need to specify a rectangle or circle around the hand in your player class/struct. Then you just need to draw the currently picked up item at those coordinates on the player.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!