Skip to main content
gamedev.net
🔒 Locked

Bitmap detection problem.

Started by VIJAY007 Nov 29, 2012 at 10:22 AM 3 replies 1.7k views
Original Post
VIJAY007
VIJAY007
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
Khatharr
Khatharr
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?
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
KingofNoobs
KingofNoobs
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.
Khatharr
Khatharr
I'm thinking he doesn't have an obstacle class, King. I think that's just his texture.
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
VIJAY007
VIJAY007
yes Obstacle is not a object.
will make it an object.
thanks all for your valuable advice.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.