Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: foz on Tue 24/02/2004 17:49:08

Title: Collision Plugin
Post by: foz on Tue 24/02/2004 17:49:08
I`m having trouble getting this to work ........does anyone know of any tuts or any pointers in the right direction to make it work.....the readme doe`snt make that much sense to me and everything i`ve tried doe`snt give the results i`m looking for...
Title: Re:Collision Plugin
Post by: Scorpiorus on Wed 25/02/2004 16:22:45
You should probably clarify what exactly you are trying to do. Thus, we can be of more help. The plugin is for detecting collisions as you know but it could perform different detection such as simple bouding box or a resource-taking pixel-perfect collision detection depending on your needs.
Title: Re:Collision Plugin
Post by: foz on Wed 25/02/2004 19:07:12
I have been working on a multi scrolling platform game...(not an adventure i know..)

...i have got a collision detection working but would like to use this plug-in as it seems from what i read a more precise way of detecting character collision than the ---AreCharactersColliding way of doing things...

I`ve tried to use the various terms that the plug-in states but have had not luck getting it to detect.....

Any one with an example of what i said be doing would be appreciated...

Thanks  foz
Title: Re:Collision Plugin
Post by: Scorpiorus on Wed 25/02/2004 20:26:58
example:

in repeatedly execute

int EGO_slot = ...;
int MAN_slot = ...;

int result = spriteSpriteColDetect(EGO, CD_CHARACTER, EGO_slot, MAN, CD_CHARACTER, MAN_slot);

if (result == CD_COLLISION) {

   Display("EGO and MAN are colliding!");
}

See, however, that you have to specify both characters' sprite slot number because in the time plugin was created there was no means to get the slot internally:

Quote
Note: slot1 and slot2 parameters are temporary and will disappear in future
versions (see 'limitations' section). Don't get too attached to them!

==============================================================================
                               Limitations
==============================================================================

The plugin currently has the following limitations:

* Due to the fact that it is not yet possible to retrieve the sprite slot
associated with a character, each plugin function receives the sprite's slot
as a parameter. This can be problematic, because since the sprite for a
character constantly changes at run-time (i.e. when the character is moving),
and the user has no way to catch these changes, collision detection will
use a wrong sprite slot and results become less accurate. As a rule of thumb,
you should try to pass the biggest sprite for that character (better safe,
than sorry...). Rest assured, that this will be corrected as soon as possible.

~Cheers
Title: Re:Collision Plugin
Post by: foz on Wed 25/02/2004 21:51:40
Thanks mate.......

Thats pushed me in the right direction.....i`d done something simialar but this helped me correct it...

thanks again

fOz