function ObilicleonWallRun()
{
if(event_type == EVENT_BLOCK)
{
WallRunning = 1;
printf("Met a wall");
}
}
THEN WITHIN THE MONSTER'S ACTION CODE...
if(my.state == 12) //Obilicleon Wall-Running
{
while(key_enter || joy_3)
wait(1);
WallRunning = 0; dash = 0; my.z += 20;
my.emask |= ENABLE_BLOCK;
my.event = ObilicleonWallRun;
while(my.state == 12)
{
while((dash<100) && WallRunning == 0)
{
my.red += 10; my.ambient = 100; my.lightrange = 100;
dash += 12 * time_step;
my.animation = 75; //75% animation frame is run3
ent_animate(me, "run", my.animation, 0);
c_move(me, vector(dash*time_step, 0, 0), vector(0, 0, -distancedown), USE_POLYGON |IGNORE_PASSABLE | IGNORE_SPRITES);
if((dash>100) && WallRunning == 0)
{
my.red = 0; my.ambient = 0; my.lightrange = 0; my.state = 3;
} //leave wall-running state because he didn't meet a wall
....rest of wall-run code here assuming he doesn't leave the wall-running state
}