PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

CGapiMaskSurface::DrawMask

Respected Sir/Madam

Regarding from the DrawMask function in CGapiMaskSurface.

now, i have been assigned to develop fighting game which need a lot of collision detection,so i would like to ask that :

Q1.Is CGapiMaskSurface designed for collision detection in Fighting game or not? From docs it is.

Q2.How to use it coz i use it and it's not displayed any things.
I declared following these in ProcessNextFrame

CGapiMaskSurface B_b; <-- declared obj B_b;

B_b.CreateSurface(0, hInstance, IDR_GIF1, TEXT "GIF")); <--- Create Surface from pic in
resource

B_b.DrawMask(0,0,dwMaskID); <-- dwMaskID i tried to change many values to match the operation below

Color = RGB(((dwMaskID&0x1F)<<3, ((dwMaskID&0x3E0)>>2), (dwMaskID&0x7C00)>>7))

but notthing come out on display screen, I just wondering whether i'm oo the right track or not.

Finally, I have looked forwarded for your kindness.

Eager reply

Regards
Hi,

Please check out the sample "Collision Mask" in the gapidraw\samples folder for information on how to use the mask surface... If it does not help you, please post here again.. :)
As it happens I started playing around with collision detection myself recently. Unfortunately the sample "Collision Mask" isn't very clear for us newbies on this subject. :oops:
Unfortunately there is no info on what the application is supposed to do, and what to expect to happen (so what to look for)...
There is some comment in the code explaining what is on the next source code line, but not really why it is done that way.
But, after some study I would say at this moment:
    1) The CGapiSurface::Intersect class method is especially usefull for collision detection of moving sprites;
    2) the CGapiMaskSurface is especially usefull for collision detection with static background images (like tiles etc.);

Am I correct in the above assumptions?

So, what I am doing now is: iterate over my list of sprites, and then for each sprite iterate again over the remaining sprites, and then use CGapiSurface::Intersect so check if the sprites collided. Does this seems a usefull approach?

Wouter