Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, 7th_zorro), 1,203 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: There is something wrong with combos [Re: Random] #374634
06/20/11 16:44
06/20/11 16:44
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
What does the while-loop do there in the if-blocks
For me they look like endless loops

while(my.skill6){wait(1);}

Maybe you should write better:

while(my.skill6 < 99 ){wait(1);}
DoCombat = FALSE; mouse_left_press = 0; combo = 2;

muffel

Re: There is something wrong with combos [Re: muffel] #374636
06/20/11 16:54
06/20/11 16:54
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
Really an endles loop?

I tryed it with while befor.(the only differens was I wrote 100 and not 99).
It worked, till the last attack.
After that it reapets the last one over and over.
thats why im trying it with if.
And without while(my.skill6){wait(1);} befor if, he woudn`t play the animation!

Last edited by Random; 06/20/11 16:55.


Re: There is something wrong with combos [Re: Random] #374640
06/20/11 16:57
06/20/11 16:57
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
while(my.skill6){wait(1);

This line wait till my.skill6 = 0 (= false)

Re: There is something wrong with combos [Re: Widi] #374669
06/20/11 20:31
06/20/11 20:31
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
I was so sure this would work, but it doesn`t;
(combo function full)
Click to reveal..
var combo = 1;
if(mouse_left == 1 && mouse_left_press == 0 && combo == 0)
{
mouse_left_press = 1;
player.animblend = attack_a;
}
if(player.animblend == attack_a && mouse_left_press == 1 && combo == 0)
{
combo = 1;
player.animblend = attack_a;
handle_sword_collision();
my.skill6 += 10 * time_step;
ent_animate(me,"attack_a",my.skill6,ANM_CYCLE);
my.skill6 %= 100;
while(my.skill6 < 100){wait(1);}
if(mouse_left == 1 && mouse_left_press == 1 && combo == 1)
{
if(my.skill6 == 100)
{
player.animblend = attack_b;
}
}
else
{
mouse_left_press = 0;
combo = 0;
player.animblend = blend;
}
DoCombat = FALSE;
}
if(player.animblend == attack_b && mouse_left_press == 1)
{
combo = 2;
player.animblend = attack_b;
handle_sword_collision();
my.skill7 += 10 * time_step;
ent_animate(me,"attack_b",my.skill7,ANM_CYCLE);
my.skill7 %= 100;
while(my.skill7 < 100){wait(1);}
if(mouse_left == 1 && mouse_left_press == 1 && combo == 2)
{
if(my.skill7 == 100)
{
player.animblend = attack_c;
}
}
else
{
mouse_left_press = 0;
combo = 0;
player.animblend = blend;
}
DoCombat = FALSE;
}
if(player.animblend == attack_c && mouse_left_press == 1)
{
combo = 0;
player.animblend = attack_c;
handle_sword_collision();
my.skill8 += 8 * time_step;
ent_animate(me,"attack_c",my.skill8,ANM_CYCLE);
my.skill8 %= 100;
while(my.skill8 < 100){wait(1);}
mouse_left_press = 0;
combo = 0;
player.animblend = blend;
DoCombat = FALSE;
}


(Combo function part by part)

When I press the left mouse butten, the player`s animblend should become attack_a.
Click to reveal..
if(mouse_left == 1 && mouse_left_press == 0 && combo == 0)
{
mouse_left_press = 1;
player.animblend = attack_a;
}


The player`s animblend has become attack_a now, so the player should beginn attacking with attack_a and wait until the animation is finished.
After the animation is finished and I press mouse left again, the player should play his next attack;
Click to reveal..
if(player.animblend == attack_a && mouse_left_press == 1 && combo == 0)
{
combo = 1;
player.animblend = attack_a;
handle_sword_collision();
my.skill6 += 10 * time_step;
ent_animate(me,"attack_a",my.skill6,ANM_CYCLE);
my.skill6 %= 100;
while(my.skill6 < 100){wait(1);}
//play attack_a and wait untill it`s finished
if(mouse_left == 1 && mouse_left_press == 1 && combo == 1 && my.skill6 < 100)
//If I press mous left again while the animation is playing
{
if(my.skill6 == 100)
//waituntil the animation is finished, to continue the combo
{
player.animblend = attack_b;
}
}
else
//If you didn`t press mouse left while the attack_a animation
{
mouse_left_press = 0;
combo = 0;
player.animblend = blend;
//Then stop the combo
}
DoCombat = FALSE;
}


Then the same game with attack b;
Click to reveal..
if(player.animblend == attack_b && mouse_left_press == 1)
{
combo = 2;
player.animblend = attack_b;
handle_sword_collision();
my.skill7 += 10 * time_step;
ent_animate(me,"attack_b",my.skill7,ANM_CYCLE);
my.skill7 %= 100;
while(my.skill7 < 100){wait(1);}
if(mouse_left == 1 && mouse_left_press == 1 && combo == 2)
{
if(my.skill7 == 100)
{
player.animblend = attack_c;
}
}
else
{
mouse_left_press = 0;
combo = 0;
player.animblend = blend;
}
DoCombat = FALSE;
}


Untill I reach attack f.

But what happens is;
When press mouse left, the player does nothing.

PS; everything else works fine.

Last edited by Random; 06/24/11 15:17.


Re: There is something wrong with combos [Re: Random] #399334
04/14/12 11:30
04/14/12 11:30
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
I totally forgotten to show, how I solved this grin :

Code:
action my_player
{
	...
	on_mouse_left = handle_attack;
	if(mouse_left_pressed>1)
	{
		var player_combo_react_time = 0; 
		while(player_combo_react_time < 5)
		{
			player_combo_react_time += 1 * time_step;
			
			wait(1);
		}
		mouse_left_pressed = 0;
	}
...
}



and here is handle attack for two attacks a row:

Code:
function handle_attack()
{
	if(player.animaten_mode == 2)
	{
		if (mouse_left_pressed == 0)
		{
			var attack_percentage = 0;
			while(attack_percentage < 100)
			{
				ent_animate(player,NULL,0,0);
				ent_animate(player,"oneh_attack_a",attack_percentage,ANM_ADD);
				attack_percentage += 10 * time_step;
				mouse_left_pressed = 1;
				mouse_left = 0;
			if(attack_percentage>50 && attack_percentage<85) {player.attacking = 1;}else{player.attacking = 0;}
				wait (1);
			}
			player.attacking = 0;
			mouse_left = 0;
			mouse_left_pressed = 2;
		}
		if (mouse_left == 1 && mouse_left_pressed == 2)
		{
			var attack_percentage = 0;
			while(attack_percentage < 100)
			{
				ent_animate(player,NULL,0,0);
				ent_animate(player,"oneh_attack_b",attack_percentage,ANM_ADD);
				attack_percentage += 10 * time_step;
				mouse_left_pressed = 2;
				mouse_left = 0;
			if(attack_percentage>5 && attack_percentage<60) {player.attacking = 1;}else{player.attacking = 0;}
				wait (1);
			}
			player.attacking = 0;
			mouse_left = 0;
			mouse_left_pressed = 0;//if you write mouse_left_pressed = 2, you can add easily more attacks 
		}
	}
}





Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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