Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,227 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Need help . . . #306039
01/19/10 08:08
01/19/10 08:08
Joined: Dec 2009
Posts: 24
DirtyDhan Offline OP
Newbie
DirtyDhan  Offline OP
Newbie

Joined: Dec 2009
Posts: 24
Im totally at lost at what to do, I have this code
====================================================
if (my.STATE == 1)
{

my.ANIMATION += 10 * time_step;
ent_animate(my, "idle", my.ANIMATION, ANM_CYCLE);
if (key_cur - key_cul)
{
my.ANIMATION = 0;
my.STATE = 2 ;
}
if(key_z)
{
my.ANIMATION = 0;
my.STATE = 4;
}
}
if(my.STATE == 4)
{
my.ANIMATION += 10 * time_step;
ent_animate(my, "firstpunch", my.ANIMATION, ANM_CYCLE);
my.ANIMATION = 0;
my.STATE = 4;
}

if(my.STATE == 4)
{
if(key_z)
{
my.ANIMATION = 0;
my.STATE = 5;
}
else
{
my.ANIMATION = 0;
my.STATE = 1;
}
}
if(my.STATE == 5)
{
my.ANIMATION += 10 * time_step;
ent_animate(my, "secondpunch", my.ANIMATION, ANM_CYCLE);
my.ANIMATION = 0;
my.STATE = 6;
}
if (my.STATE == 6)
{
my.ANIMATION = 0;
my.STATE = 1;
}
=========================================================
the first time the z button is pressed, it should execute an attack. But then if I press the z button, for some reason the animation is like restraining it self to punch. it doesnt complete the punch animation.


Last edited by DirtyDhan; 01/19/10 08:38.

If you do not know where you are . . .
Ask a villager.
Re: Need help . . . [Re: DirtyDhan] #306045
01/19/10 09:50
01/19/10 09:50
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
can you please make one topic for your problems, they are all related to the same piece of code...

anyway, what happens here is that when you press z, in one frame it think you are already doing the second punch, and when it comes to secondpunch, it immediatly jumps back to idle...

I havent tested the following, but should atleast get you started:
Code:
if (my.STATE == 1)
{
   my.ANIMATION += 10 * time_step;
   ent_animate(my, "idle", my.ANIMATION, ANM_CYCLE);

   if (key_cur - key_cul)
   {
      my.ANIMATION = 0;
      my.STATE = 2;
   }
   if(key_z)
   {
      my.ANIMATION = 0;
      my.STATE = 4;
   }
}
if(my.STATE == 4)
{
   while(my.ANIMATION < 99) {
      my.ANIMATION += 10 * time_step;
      ent_animate(my, "firstpunch", my.ANIMATION, ANM_CYCLE);
      wait(1);
   }
   
   if(key_z)
   {
      my.ANIMATION = 0;
      my.STATE = 5;
   }
   else
   {
      my.ANIMATION = 0;
      my.STATE = 1;
   }
}
if(my.STATE == 5)
{
   while(my.ANIMATION < 99) {
      my.ANIMATION += 10 * time_step;
      ent_animate(my, "secondpunch", my.ANIMATION, ANM_CYCLE);
      wait(1);
   }
   
   my.ANIMATION = 0;
   my.STATE = 1;
}



2 things; if you hold z, it will also already do 2 punches (in a row though laugh ), and, it stops your player from doing anything but animate while punching...

again, this is only a rough start, and nowhere near pretty code... good luck with this.

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Need help . . . [Re: Helghast] #306085
01/19/10 15:51
01/19/10 15:51
Joined: Dec 2009
Posts: 24
DirtyDhan Offline OP
Newbie
DirtyDhan  Offline OP
Newbie

Joined: Dec 2009
Posts: 24
hehe, gee thx. I've already finished all of the controls a while ago. now I'm working on collisions. thx a lot 4 tis ^^


If you do not know where you are . . .
Ask a villager.

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