Yuck... really hard IMO... read on...


[ Follow Ups ] [ Post Followup ] [ Jed Messages ]

Posted by CogKing on February 01, 1998 at 18:54:46:

In Reply to: Whenever player touches anything they are damaged posted by Raptor [JiB] on February 01, 1998 at 18:07:16:

> > You can play with GetThingSector(), then the cog verbs to enumerate the
> > surfaces in the current sector, compute the distance from the player to these
> > surfaces, etc. but I think it will be a pain IMHO...
> > What do you want to do exactly ?

> I don't want to use a cog to make every surface damaging.

OK, then do it the hard way :

mySector = GetThingSector(player);
numSurfaces = GetNumSectorSurfaces(mySector);

for(i=0; i < numSurfaces; i = i + 1)
{
curSurface = GetSectorSurfaceRef(mySector, i);
if(GetSurfaceFlags(curSurface) & 0x1)
{
// this is a floor
// probably don't do anything...
}
else
{
// not a floor
distance = VectorDist(GetSurfaceCenter(curSurface), GetThingPos(player));
if(distance < aCertainDistance)
{
// apply damage
// ...
}
}
}

This is of course far from perfect (distance from a surface is not distance
to its center), but it would be a step in the right direction...

-CogKing


Follow Ups:



Post a Followup

Name:
E-Mail:
Subject:
Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ Jed Messages ]