Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, juanex, Grant), 1,018 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Shoot a mashinggun #266799
05/19/09 19:17
05/19/09 19:17
Joined: Mar 2009
Posts: 207
E
Erick_Castro Offline OP
Member
Erick_Castro  Offline OP
Member
E

Joined: Mar 2009
Posts: 207
I would like to know how can i shoot many bullets with only one clik.

I execute this function from my player action

function ent_gun()
{




while (mouse_left == on) {wait (1);}

// if(mouse_left && counter == 0)
if( counter == 0)

{

disparar();
counter = 1;
snd_stop(shoot_handle);
wait(1);

if(current_weapon==2){
shoot_handle = snd_play(gun2_shoot,10,0);
}


while (idle_percent2 <= 100)
{

idle_percent2 += 10*time_step;
ent_animate(selected_weapon,"shot",idle_percent2,ANM_CYCLE);
wait(1);

}

shoot_handle = snd_play(gun1_reload,90,0);


}
if ( idle_percent2 >= 100 )
{
//disparar();
counter = 0;
idle_percent2 = 0;
shoot_handle = null;

}
wait(1);
//}


}


When i press left mouse Ent_gun executes only one shoot
because the line
while (mouse_left == on) {wait (1);}
prevents an "infinite" cycle.

But i woul like to implement in my weapon system , for example, an AK47 mashing gun that shoot 5 bullets with only one click.

Re: Shoot a mashinggun [Re: Erick_Castro] #266808
05/19/09 21:00
05/19/09 21:00
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline
Expert
Locoweed  Offline
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
Code:
#define bDelayFire skillxx // xx is whatever skill you want to use

...

if (mouse_left == on)
{
   if(!my.bDelayFire)
   {
       //** Shoot the gun here **//
       gunDelayFire(.1); // delay in seconds
   }
} 

...

function gunDelayFire(secs)
{
   my.bDelayFire = 1;
   wait(-secs);
   my.bDelayFire = 0;
}



Loco


Professional A8.30
Spoils of War - East Coast Games
Re: Shoot a mashinggun [Re: Locoweed] #266812
05/19/09 22:06
05/19/09 22:06
Joined: Mar 2009
Posts: 207
E
Erick_Castro Offline OP
Member
Erick_Castro  Offline OP
Member
E

Joined: Mar 2009
Posts: 207
Thank you, Loco!

Re: Shoot a mashinggun [Re: Erick_Castro] #266831
05/20/09 06:08
05/20/09 06:08
Joined: May 2009
Posts: 258
Chicago
J
Jaeger Offline
Member
Jaeger  Offline
Member
J

Joined: May 2009
Posts: 258
Chicago
If you're trying to make your shooter game realistic, then you might want to know this:

An AK-47 is *not* a machine gun. It's considered an "infantry assault weapon". A real, military grade AK-47 has only two modes of firing:

1) semi-auto (fires one shot per trigger pull)
2) full-auto (fires bullets until trigger is released or magazine is empty)

AK-47s don't fire "bursts" of rounds with a single trigger pull. On full-auto, they fire at a rate of about 600rpm (rounds per minute).

Trust me, I'm one of those crazy American gun collectors! laugh But if you aren't trying to make a very realistic game, then don't worry about this. I just love realistic games, heheh.

Re: Shoot a mashinggun [Re: Jaeger] #266944
05/21/09 00:16
05/21/09 00:16
Joined: Mar 2009
Posts: 207
E
Erick_Castro Offline OP
Member
Erick_Castro  Offline OP
Member
E

Joined: Mar 2009
Posts: 207
Thank youm, Jaeger, for your information about AK47

Re: Shoot a mashinggun [Re: Erick_Castro] #266968
05/21/09 06:35
05/21/09 06:35
Joined: May 2009
Posts: 258
Chicago
J
Jaeger Offline
Member
Jaeger  Offline
Member
J

Joined: May 2009
Posts: 258
Chicago
You're more than welcome! laugh

If you ever need more info about particular guns, you can always ask. I can even take reference pictures if you want to build models of any guns I have. It's really hard to find good reference pics for modeling guns online. I haven't been able to find good 3 view pics of the Mauser 98 or Gewehr 43 yet. frown


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