This is what I have so far.
Code:
#define state skill1

var movement;
var allow_fire;
var p_angle;
ENTITY* enemy = "enemy.mdl";

function state_wait ()
{
	while (1) c_move (me, nullvector, nullvector, 0);
	c_scan (my.x,my.pan, vector (360,0,1000), SCAN_ENTS | IGNORE_ME);
	if (event_type =EVENT_SCAN) my.state = 2;
	wait (1);
}
function state_attack ()
{
	if (my.state == 2)
	{
		while(1) c_move(me,vector(player.x,player.y,0), nullvector,GLIDE);
	}
}

action enemy_act ()
{
        enemy = my;
	my.state = 1;
	while (my)
	{
		switch (my.state)
		{
			case 1: state_wait(); break;
			case 2: state_attack(); break;
		}
	}
}


But for some reason the enemy doesn't move towards the player when the player is in proximity of the enemy. Does everyone have this much trouble when they start to learn or is it just me? confused

Last edited by Panda_Dude; 04/09/11 08:07.