Jump to content

  • Log In with Google      Sign In   
  • Create Account

Bitmap detection problem.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 VIJAY007   Members   -  Reputation: 107

Like
0Likes
Like

Posted 29 November 2012 - 04:22 AM

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 :)

Sponsor:

#2 Khatharr   Crossbones+   -  Reputation: 3040

Like
0Likes
Like

Posted 29 November 2012 - 06:32 AM

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.

#3 KingofNoobs   Members   -  Reputation: 301

Like
0Likes
Like

Posted 29 November 2012 - 07:31 AM

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.

I wonder as I wander...

http://www.davesgameoflife.com


#4 Khatharr   Crossbones+   -  Reputation: 3040

Like
0Likes
Like

Posted 29 November 2012 - 02:36 PM

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.

#5 VIJAY007   Members   -  Reputation: 107

Like
0Likes
Like

Posted 30 November 2012 - 03:29 AM

yes Obstacle is not a object.
will make it an object.
thanks all for your valuable advice.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS