So... I'm working on collision detection. I was using sensors.
What I'd like to do is something like this:
CollWith = collision (0); // Collision with any type of process.
...
if (CollWith == type EnemyFlying)
...
In other words, having a variable that holds the process id of anything colliding with that process, and having it dealt with later on. The thing is, the collision documentation indicates that this is not possible (http://wiki.bennugd.org/index.php?title=Collision); you must pass collision a valid process ID. Is this right?
Try this:
PROCESS player();
PRIVATE
int id2;
BEGIN
IF (id2=collsion(TYPE enemy))
// do something
END
END
Id2 should now contain the id code of the process that collided with player process.
I was thinking something more along the lines of:
while (1)
CollWith = collision (0); // If this process is colliding with anything, CollWith will store the ID of the process being collided with.
if (CollWith != 0) // Do something if CollWith is non-zero, i.e. a collision has happened.
if (CollWith == type FlyingEnemy) // If collided with this type of process...
...
end
end
end
From what I understand it doesn't matter what parameters you pass collision, yes? That said, I have doubts about the "if (CollWith == type FlyingEnemy)" line...