Okay, I wrote this simple (but complete) test code. but to my shock the entity was never hidden. I just want to know what did I do wrong. I'm sure I have assigned my action to a model because when I press F7 the model is moved by 20 quants as you will see later in code.



Click to reveal..

#include <acknex.h>
#include <default.c>

ENTITY* Badrizmo;


var ShowHideFlag = 0;
function ShowHideBadrizmo ()
{
if (ShowHideFlag == 0)
{
//Hide the entity
Badrizmo.flags &=~VISIBLE;

Badrizmo.x +=20;
ShowHideFlag = 1;
}
else
{
//Show the entity
Badrizmo.flags |= VISIBLE;
ShowHideFlag = 0;
}

}




function main()
{
level_load("shop.wmb");
wait (2);
on_f7 = ShowHideBadrizmo;
}

action move()
{
Badrizmo = me;

while (1)
{
if(key_w)
{
c_move(me,vector(5*time_step,0,0),nullvector, GLIDE);
}
if(key_s)
{
c_move(me,vector(5* -time_step,0,0),nullvector, GLIDE);
}
if(key_a)
{
me.pan +=4*time_step;
}
if(key_d)
{
me.pan -=4*time_step;
}
wait(1);
}
}


when I replaced
Badrizmo.flags &=~VISIBLE;
by
Badrizmo.flags &=~INVISIBLE;

and
Badrizmo.flags |= VISIBLE;
by
Badrizmo.flags |= INVISIBLE;

it worked fine and I was toggoleing between hidden and visible by F7, I need to know why did the original code didn't work (the one utilizing the VISIBLE flag).

Thanks in advance for your valuable help.