Hi there
I would like to trigger some events when the mouse cursor is over the current playe (Players[0]), but I cannot find how to test see.
I've seen this in the code :
Code:
// move player
if(Ms.bp(0) && Players.elms()) // on LMB pressed
if(!Gui.ms() || Gui.ms()==Gui.desktop())
{
if(Cur.valid)
{
if(Cur.obj.valid())
{
if(Chr *chr=CAST(Chr, &Cur.obj()))Players[0].actionAttack(*chr);
}else
{
Players[0].actionMoveTo(Cur.pos);
}
}
}
The object under the cursor is casted to Chr object, if the cast is successful, the pointer character is attacked.
I wanted to use a similar algo to check if my Players[0] is under the cursos, but it failed.
It seems that the Cur.obj.valid() returns 0 when the cursor is over my player.
If I am correct, it means that the cursor update() function ray cast didn't hit successfully... Can somebody explain me why ?
The Players[0] isn't part of the AG_PLAYER actor group ? Or some other reason ?
Thanks guys !