Gamestudio Links
Zorro Links
Newest Posts
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
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,182 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
There is something wrong with combos #374459
06/18/11 22:26
06/18/11 22:26
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
So im almost finished with my new player moment.
And ofcourse there is a problem grin
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;


Click to reveal..
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 Offline
User
Aku_Aku  Offline
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:
Code:
printf("combo-0");


or
Code:
printf("combo-1");



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 Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
Quote:
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. wink

Last edited by Redeemer; 06/19/11 16:57.

Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: There is something wrong with combos [Re: Redeemer] #374513
06/19/11 17:18
06/19/11 17:18
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
In case you can't solve Redemeer's exercise, notice that you check for a combo immediately after you did the first attack, which means the combo attack will always be executed at the same time as the first attack, because you just set combo = 1; before that.

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 Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
Wow, that was a fast respawn grin
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 Offline OP
User
Random  Offline 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 Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
Ämm, why isn`t this working?

Click to reveal..
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: Random] #374622
06/20/11 15:37
06/20/11 15:37
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
It is unlikely that it hits exactly the value 100.
Try f.i. >= 95

Re: There is something wrong with combos [Re: Pappenheimer] #374624
06/20/11 15:39
06/20/11 15:39
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Additionally,
if(my.skill6 = 100)
sets skill6 to 100, you forgot one "=". As Pappenheimer has already said, you should not write it, though.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
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 Offline OP
User
Random  Offline 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...



Page 1 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