1 registered members (henrybane),
1,182
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
There is something wrong with combos
#374459
06/18/11 22:26
06/18/11 22:26
|
Joined: Feb 2010
Posts: 886
Random
OP
User
|
OP
User
Joined: Feb 2010
Posts: 886
|
So im almost finished with my new player moment. And ofcourse there is a problem What I want; When I press mouse left, the player should start his combo. Moreover when I press mouse left again, the player should continue his combo. What happens; My player only attacks with his first attack (no combo) Here is the code part; var combo = 0; if(mouse_left == 0 && mouse_left_press == 1) mouse_left_press = 0; if(mouse_left == 1 && mouse_left_press == 0 && combo == 0) { my.animblend = attack_a; handle_sword_collision(); my.skill6 += 10 * time_step; ent_animate(me,"attack_a",my.skill6,ANM_CYCLE); DoCombat = FALSE; mouse_left_press = 0; combo = 1; } if(mouse_left == 1 && mouse_left_press == 0 && combo == 1) { my.animblend = attack_b; handle_sword_collision(); my.skill7 += 10 * time_step; ent_animate(me,"attack_b",my.skill7,ANM_CYCLE); DoCombat = FALSE; mouse_left_press = 0; } Thanks futuremore (i hope)
|
|
|
Re: There is something wrong with combos
[Re: Random]
#374509
06/19/11 16:49
06/19/11 16:49
|
Joined: Sep 2009
Posts: 993 Budapest
Aku_Aku
User
|
User
Joined: Sep 2009
Posts: 993
Budapest
|
Seems to me your code has some flaws but should work. You can check wich part of your function is executed if you place printf statements in each part. Like this: or
|
|
|
Re: There is something wrong with combos
[Re: Aku_Aku]
#374510
06/19/11 16:56
06/19/11 16:56
|
Joined: Dec 2008
Posts: 1,660 North America
Redeemer
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,660
North America
|
You can check wich part of your function is executed if you place printf statements in each part. Or, you can tackle the problem like a real programmer would with a debugger. Figure out how the Gamestudio debugger works and trace through your code a little bit. It'll soon be clear what the problem is if you do that. I can see the logical error you have in your code as I write this, but I think it's important that you learn to fix issues such as these yourself, so I leave this up to you as an exercise.
Last edited by Redeemer; 06/19/11 16:57.
|
|
|
Re: There is something wrong with combos
[Re: Lukas]
#374518
06/19/11 18:23
06/19/11 18:23
|
Joined: Feb 2010
Posts: 886
Random
OP
User
|
OP
User
Joined: Feb 2010
Posts: 886
|
Wow, that was a fast respawn Thanks for the tipps, when im done I post the script here for thoses who also were interrestet.
|
|
|
Re: There is something wrong with combos
[Re: Random]
#374530
06/19/11 20:08
06/19/11 20:08
|
Joined: Feb 2010
Posts: 886
Random
OP
User
|
OP
User
Joined: Feb 2010
Posts: 886
|
And please, nobody tell me what the problem is now.
|
|
|
Re: There is something wrong with combos
[Re: Random]
#374617
06/20/11 15:31
06/20/11 15:31
|
Joined: Feb 2010
Posts: 886
Random
OP
User
|
OP
User
Joined: Feb 2010
Posts: 886
|
Ämm, why isn`t this working? if(mouse_left == 0 && mouse_left_press == 1) mouse_left_press = 0; if(mouse_left == 1 && mouse_left_press == 0 && combo == 0) { player.animblend = attack_a; handle_sword_collision(); my.skill6 += 10 * time_step; ent_animate(me,"attack_a",my.skill6,ANM_CYCLE); while(my.skill6){wait(1);} if(my.skill6 = 100){wait(1); DoCombat = FALSE; mouse_left_press = 0; combo = 1;} } if(mouse_left == 1 && mouse_left_press == 0 && combo == 1) { player.animblend = attack_b; handle_sword_collision(); my.skill7 += 10 * time_step; ent_animate(me,"attack_b",my.skill7,ANM_CYCLE); while(my.skill7){wait(1);} if(my.skill7 = 100){wait(1); DoCombat = FALSE; mouse_left_press = 0; combo = 2;} } if(mouse_left == 1 && mouse_left_press == 0 && combo == 2) { player.animblend = attack_c; handle_sword_collision(); my.skill8 += 8 * time_step; ent_animate(me,"attack_c",my.skill8,ANM_CYCLE); while(my.skill8){wait(1);} if(my.skill8 = 100){wait(1); DoCombat = FALSE; mouse_left_press = 0; combo = 0;} } Doesn`t (for exsample) "if(my.skill6 = 100)" meen; If the animationen is played to 100 prozent then...???
Last edited by Random; 06/20/11 15:31.
|
|
|
Re: There is something wrong with combos
[Re: Superku]
#374632
06/20/11 16:13
06/20/11 16:13
|
Joined: Feb 2010
Posts: 886
Random
OP
User
|
OP
User
Joined: Feb 2010
Posts: 886
|
Yes, youre right it doesn`t work... But it makes to me no sence, look;
if(my.skill8 >= 95)
Everything I write after that should happen after the animation is finished, so;
DoCombat = FALSE; mouse_left_press = 0; combo = 1;
Now combo is set to 1 and mouse_left_press ist set to 0 again.
Why does this function dosen`t start then???;
if(mouse_left == 1 && mouse_left_press == 0 && combo == 1)
This is wired...
|
|
|
|