Advertisement Jump to content
Sign in to follow this  
VIJAY007

Bitmap detection problem.

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

Hi guys

I have a bitmap named obstacle.

i have drawn bitmap the bitmap in several places.

psedo code.

draw(obstacle,10,10,null);------------1
draw(obstacle,45,10,null);------------2
draw(obstacle,16,10,null);------------3
draw(obstacle,50,60,null);------------4
draw(obstacle,20,50,null);------------5

my problem is how to identify these 5 drawn objects indivually.
eg:- for collision detection i have a character.
if it collides with anyone it should die.
i have like
charcollides with obstacle then die.

my prob is it die only when it collides with first obstacle since all obstacles names are same.
what to do ???



one more thing how to get accurate values from accelometer ?

Thanks in advance :)

Share this post


Link to post
Share on other sites
Advertisement
Have your collidable objects represented by their own class. The objects can hold the bitmaps (sprites, really) and then you would have a collection of them.

If you can be more specific about your implementation then we can give more specific advice, but to state it broadly this is not a case where a 'bitmap' should be part of your logic. It should only be part of the representation of the outcome of your logic.

Can you post some code for us?

Share this post


Link to post
Share on other sites
VIJAY007,

You are going to need to create 5 separate instances of your Obstacle class, each with their own globally unique identifier (GUID). A good way to do this is to inherit publicly from a BaseGameEntity class that does all the registration and GUID assigning work for you on construction.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!