Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Joey, flink, AndrewAMD, ozgur, Ayumi), 1,195 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how to use ent_blend? #242175
12/21/08 19:05
12/21/08 19:05
Joined: Sep 2008
Posts: 69
U
upsidedownman Offline OP
Junior Member
upsidedownman  Offline OP
Junior Member
U

Joined: Sep 2008
Posts: 69
Hi, i am trying to make my players animation look better so i tried using ent_blend but how do you use it? I read the manual description of it but it really doesn't help.

here is what i want to use it for,
Code:
if(key_w)
{
	ent_animate(player, "run", run_speed, ANM_CYCLE);
}

if(key_s)
{
	ent_animate(player, "walk_back", walk_speed, ANM_CYCLE);
}

if(key_w == NULL && key_s == NULL)
{
		run_speed = 0; walk_speed = 0;
		 ent_animate(player, "stand", stand_speed, ANM_CYCLE);
}


i want it to go smoothly from stand to run and vice versa. But how would i use ent_blend to do this?

Thanks ahead of time.

Re: how to use ent_blend? [Re: upsidedownman] #242184
12/21/08 19:46
12/21/08 19:46
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
it's quite difficult to do that. i'm using this David Lancaste's code from KH Movement tutorial:

animate.c
Code:
//*******************************************************
// -- DEFINES -- 
//*******************************************************
#define animate skill31
#define animate2 skill32
#define animblend skill33
#define currentframe skill34
#define blendframe skill35

#define nullframe -2
#define blend -1
#define stand 0
#define run 1
#define walk 2
#define jump 3
#define fall 4
#define crouch 5
#define stand_aim 6

// Movement speed constants

#define run_speed 18
#define strafe_speed 12
#define run_animation_speed 16


//*******************************************************
// -- HANDLE ANIMATION -- function
//*******************************************************
function handle_animation(animation_speed) 
{
	while(1){
	if (animation_speed <= 0) animation_speed = 1;
	
	if (my.animblend != blend && my.blendframe != nullframe) 
	{ 
		my.animate2 = 0;
		my.animblend = blend;
	}
	
	if (my.animblend == blend)
	{
		if (my.currentframe == stand) ent_animate(my,"stand",my.animate,ANM_CYCLE);
		if (my.currentframe == run) ent_animate(my,"run",my.animate,ANM_CYCLE);
		if (my.currentframe == walk) ent_animate(my,"walk",my.animate,ANM_CYCLE);
		if (my.currentframe == crouch) ent_animate(my,"crouchaim",my.animate,ANM_CYCLE);
		if (my.currentframe == stand_aim) ent_animate(my,"standaim",my.animate,ANM_CYCLE);
		if (my.blendframe == stand) ent_blend("stand",0,my.animate2);
		if (my.blendframe == run) ent_blend("run",0,my.animate2);
		if (my.blendframe == walk) ent_blend("walk",0,my.animate2);
		if (my.blendframe == crouch) ent_blend("crouchaim",0,my.animate2);
		if (my.blendframe == stand_aim) ent_blend("standaim",0,my.animate2);
		
		my.animate2 += 45 * time_step;
		
		if (my.animate2 >= 100) 
		{
			my.animate = 0;
			my.animblend = my.blendframe;
			my.blendframe = nullframe;
		}
	}
	
	if (my.animblend == stand) 
	{
		ent_animate(my,"stand",my.animate,ANM_CYCLE);
		my.animate += 1 * animation_speed * time_step;
		my.animate %= 100;
		my.currentframe = stand;
	}
	
	if (my.animblend == run) 
	{
		ent_animate(my,"run",my.animate,ANM_CYCLE);
		my.animate += 7 * animation_speed * time_step;
		my.animate %= 100;
		my.currentframe = run;
	}
	
	if (my.animblend == walk) 
	{
		ent_animate(my,"walk",my.animate,ANM_CYCLE);
		my.animate += 7 * animation_speed * time_step;
		my.animate %= 100;
		my.currentframe = walk;
	}
	if (my.animblend == crouch) 
	{
		ent_animate(my,"crouchaim",my.animate,ANM_CYCLE);
		my.animate += 7 * animation_speed * time_step;
		my.animate %= 100;
		my.currentframe = crouch;
	}
	if (my.animblend == stand_aim) 
	{
		ent_animate(my,"standaim",my.animate,ANM_CYCLE);
		my.animate += 7 * animation_speed * time_step;
		my.animate %= 100;
		my.currentframe = stand_aim;
	}
	wait(1);
}

}




and then put a call handle_animation(1); in a while loop in player function or main function.


and then use it like this in player function loop:
Code:
if (key_w || key_s && key_c)   
			{
				if (my.animblend == stand) 
				{ 
					if (key_shift == 1) { my.blendframe = run; } else { my.blendframe = walk; }
				}
				if (my.animblend == walk && key_shift == 1) { my.blendframe = run; }
				if (my.animblend == run && key_shift == 0) { my.blendframe = walk; }
			} 
			if (!key_w && !key_s && !key_c)
			{
				if (my.animblend > stand) 
				{ 
					my.blendframe = stand;
				}
			}	
			if(key_c) 
			{
				if(my.animblend != crouch)
				{
					my.blendframe = crouch;
				}
			}




Ubi bene, ibi Patria.
Re: how to use ent_blend? [Re: croman] #242186
12/21/08 19:52
12/21/08 19:52
Joined: Sep 2008
Posts: 69
U
upsidedownman Offline OP
Junior Member
upsidedownman  Offline OP
Junior Member
U

Joined: Sep 2008
Posts: 69
Thanks ill try and use that hopefully get to understand it along the way lol.

Thanks again!

Re: how to use ent_blend? [Re: upsidedownman] #242188
12/21/08 19:55
12/21/08 19:55
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
it will work really nice. i'm using it for quite a long time and still i'm having troubles understanding that blending perfectly lol



Ubi bene, ibi Patria.
Re: how to use ent_blend? [Re: croman] #242194
12/21/08 20:11
12/21/08 20:11
Joined: Aug 2008
Posts: 218
U.S.
GamerX Offline
Member
GamerX  Offline
Member

Joined: Aug 2008
Posts: 218
U.S.
I agree ent_blend is tricky at times your best bet would be to use that script try to add on to it until you get it right then just keep improving it until you know how to use it correctly.


"You may never know what results come of your action, but if you do nothing there will be no result."
-Mahatma Gandhi

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1