Hi there,
I wanna loop through all worms each frame, checking if they are too far up in the sky and changing their speed to point downwards if that is the case.
However, when checking this script, the compiler can't find the PosY field of foundObj.
Do I have to cast a CWorm out of the found object? I thought this is not needed because there are virtually no "types" in EAX?
Code:
require utils;
CAntiPatience : CObject;
void CAntiPatience::Message(CObject* sender, EMType type, int size, CMessageData* data)
{
// Calculations each frame
if (type == M_FRAME)
{
// Iterate through all objects
for (local i = 1; i < Env->Objs.Count; i++)
{
// Check if the found object is a worm
local foundObj = Env->Objs.GetObject(i);
if (foundObj == CWorm)
{
// Check the coordinates
if (foundObj->PosY > 300) // Problem here: Doesn't find PosY-field
{
foundObj->SpY = -200;
}
}
}
}
}
Would be nice if you could fix my head
Greetings,
Pac-Man