Posted By
|
Message
|
Zi-Xiao
Registered 29/07/2002
Points 537
|
8th September, 2004 at 18:42:47 -
K, first of all heres my code, its pretty basic and everyone should be able to understand it:
-begin code-
If
User left clicks
+ weapon = 1
+ fire delay = 0
+ ammo > 0
Then
Restore animation of PISTOL
+ Set animation of PISTOL to 'shooting'
+ Create BULLET at (0,0) from PISTOL
+ Set direction of BULLET to direction of PISTOL
+ random(2) - random(2)
+ set speed of BULLET to 100
+ set value C of BULLET to 12
+ set fire delay = 1
+ play sample 'pistol.wav'
Always subtract 1 from fire delay
-end code-
So i shoot a gun on a mouse click right? Well, the gun doesn't ALWAYS fire on every mouse click. Some times i could click 2 or 3 times before the gun fires. Machine independent speed is on (i also tried it with off).
So whats the problem? And before anyone suggests its: no, my computer doesn't suck.
n/a
|
Radix hot for teacher
Registered 01/10/2003
Points 3139
|
8th September, 2004 at 18:47:43 -
Er, I doubt this has much to do with the problem, but you should probably change
Always
-subtract 1 from fire delay
to
Fire delay > 0
-subtract 1 from fire delay
Uh... wait, now that I look at it, where exactly is 'fire delay' used?
n/a
|
Coop
Registered 15/08/2004
Points 347
|
8th September, 2004 at 19:09:16 -
I would instead of putting always subtract 1 from fire delay would put something like Every .02 milliseconds set fire delay to 0, because when you say always subtract 1 it will go into negatives and such. But what the hell do i know i am a Newbie
...
|
Radix hot for teacher
Registered 01/10/2003
Points 3139
|
8th September, 2004 at 19:45:35 -
I assume it's the way it is so that other events can influence firing delay. Otherwise he'd be using a flag... right?
n/a
|
Coop
Registered 15/08/2004
Points 347
|
8th September, 2004 at 19:48:35 -
Well if any other events influence the fire delay than they should be said cause they would most likely be the problem
...
|
Zi-Xiao
Registered 29/07/2002
Points 537
|
8th September, 2004 at 20:28:01 -
Fire delay is just a little technique that i use for weapons in general. I find the 'fire delay' method (in conjunction with others) is very useful when it comes to programming engines since its very easy to add multiple weapons because you can just copy and paste code.
Anyways as to how fire delay actually works, basically its a counter with 0 as its minimum and 99999 etc as its highest value and its initial value is 0. I set it as hidden. Whenever something is done with weapons I always make sure that fire delay is 0. This works well for semi and full automatic weapons. A full automatic weapon might look something like this:
- begin code -
If
User repleat while pressing Ctrl
+ weapon = 1
+ fire delay = 0
+ ammo > 0
Then
UZI shoots BULLET object in the direction of UZI at speed 100
+ Play sample 'uzi fire'
- end code -
So thats what fire delay does. Now with that cleared up, do you guys have ANY more suggestions as to what the problem is? Oh btw, if i replace 'User left clicks' with 'key is pressed' I can press the key x number of times and the gun would fire x number of bullets, so I still think its a mouse problem :S
n/a
|
David Newton (DavidN) Invisible
Registered 27/10/2002
Points 8322
|
8th September, 2004 at 21:08:37 -
I think it might be because if you click too fast, the computer picks it up as a double click. I really can't remember if Click products have that problem, though.
http://www.davidn.co.nr - Games, music, living in America
|
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
|
9th September, 2004 at 03:20:00 -
If you are not using mouse movement, then do so. Change on mouse click to on pressed fire 1. That should work.
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy
|
Tigerworks Klik Legend
Registered 15/01/2002
Points 3882
|
9th September, 2004 at 12:04:26 -
Wong Chung Bang is right, Windows will be detecting close-together clicks as double clicks. Copy and paste the event and replace "User clicks" with "User double-clicks" then the event will run for both clicks alone, and clicks which counted as double clicks, so it runs on every click.
- Tigerworks
|
Zi-Xiao
Registered 29/07/2002
Points 537
|
10th September, 2004 at 08:51:00 -
i'll give that a try
n/a
|
Kramy
Registered 08/06/2002
Points 1888
|
13th September, 2004 at 02:21:00 -
Use "Repeat while mouse key is pressed"
Clicks and even Double-clicks can take a long time to "turn off".(on my system 100 or 200 ms - meaning under 10 clicks per second - not very good for rapid fire) Since you're using a fire delay anyway, just set the delay to something like 2.(that way it will be 1 the next frame, and 0 after that, so the event will fire 25 times per second.)
Kramy
|
Tigerworks Klik Legend
Registered 15/01/2002
Points 3882
|
13th September, 2004 at 12:57:42 -
Clicks don't take time to "turn off", after a double click it immediately resets so any subsequent clicks/double clicks are still counted.
- Tigerworks
|
Kramy
Registered 08/06/2002
Points 1888
|
14th September, 2004 at 18:04:30 -
You're forgetting about the user's settings. Some people are crazy and set clicks so huge - meaning they can click a second apart and it still registers as a double-click.
Mine registers about 10 clicks per second, maximum. I've found no way to change this, other than changing click sensitivity, which isn't really an option since my parents want to pick up their email too.
Kramy
|
|
|