I'm not exactly sure what you are after in the text, so with the aid of google translator and your comic strip here's something similar to what I think you're after grin
Code:
#include <acknex.h>
#include <default.c>

#define _anim_percent skill[0]

var player_in_range(){
	
	if(player){
		
		if(vec_dist(player.x, my.x) < 200){
			return(TRUE);
		}
	}
	return(FALSE);
}

action holzo(){
	
	VECTOR temp;
	var dist;
	while(me){
		
//		my._anim_percent = cycle(my._anim_percent + time_step, 0, 100);
//		ent_animate(me, "direction", my._anim_percent, ANM_CYCLE);
		if(player_in_range()){
			
			dist = vec_dist(player.x, my.x);
			DEBUG_VAR(vec_dist(player.x, my.x), 40);
			
			vec_set(temp, player.x); 
			vec_sub(temp, my.x);
			vec_to_angle(temp, temp);
			
			DEBUG_VAR(temp.x, 70);
			DEBUG_VAR(temp.y, 90);
			//my.pan += 45;
			
			
			if(temp.x < 176){
				my._anim_percent = (200-dist) / 2;
				ent_animate(me, "direction", my._anim_percent, ANM_CYCLE);
				DEBUG_VAR(my._anim_percent, 120);
			}else{
				my._anim_percent = (200-dist) / 2;
				ent_animate(me, "ignore", my._anim_percent, ANM_CYCLE);
			}
			
		}else{
			
			my._anim_percent = cycle(my._anim_percent + time_step, 0, 100);
			ent_animate(me, "stand", my._anim_percent, ANM_CYCLE);
		}
		wait(1);
	}
}

action justsid(){
	
	VECTOR vecFrom, vecTo;
	player = me;
	
	while(me){
		
		vec_set(vecTo, vector(mouse_pos.x, mouse_pos.y, 500));
		vec_for_screen(vecTo, camera);
		
		vec_set(my.x, vecTo.x);
		wait(1);
	}
}

void main(){
	
	wait(1);
	
	warn_level = 0;
	mouse_mode = 4;
	
	level_load(NULL);
	ent_create(CUBE_MDL, vector(0, 500, 0), justsid);
	ent_create("holzo.mdl", vector(0, 500, 0), holzo);
	camera.pan = 90;
	
}

use the mouse to control the player, the animation is quite restrictive to the players position so I'd probably use bone rather than vertex animation for best results.

if you're working on a 2D platformer this should hopefully work though you may need to change the angles if the camera angle is different.

Have a play with the values, just some food for thought.

Edit: I've also renamed "Direction2" anim to "ignore" as GS will loop through both when using Direction

Last edited by MrGuest; 10/18/11 15:09. Reason: GSBug?