Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How can I get my bullets to shoot rapidly for a machine gun, and not once/twice per click?

Author
Message
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 10th Feb 2003 04:19
Here is my full game code. The shooting part is in the main loop near the middle.. With this code I have here, if I click or click and hold my mouse button, only one or two bullets come out, then it waits for bullet life to equal 0 and then it shoots one or two more even though I'm holding the mouse down. Now, my gun is a machine gun and I need the bullets to come out not one by one, but very rapidly like a machine gun. Thanks for all your help, if you help me!

sync on
hide mouse
fog on

rem the music
load music "media\menu.wav",1
loop music 1

load sound "media\p228-2.wav",1
load sound "media\clipin.wav",2

rem the opening
cls
Input "What is your name ", name$
print "Hello " ; name$
print "I'll see you on the battlefield!"
wait 1100
set cursor 250,185
print "Loading textures"
wait 750
set cursor 250,200
print "Loading matrix"
wait 100
set cursor 250,215
print "Loading weapons"
wait 850
set cursor 250,230
print "Loading sounds"
wait 900
set cursor 250,245
print "Loading music"
wait 775
set cursor 250,260
print "Done Loading!!"
wait 650


sync

rem the backdrop

backdrop on
color backdrop 12


rem the gun
load object "media\assult.x",1
rem Get it facing the right way
yrotate object 1,90
fix object pivot 1
rem Make it a better size
scale object 1,410,410,410
rem THIS IS WHERE THE GUN IS PLACED. CHANGE THESE TO MOVE THE GUN.
position object 1,25,-32.5,50
rem THIS COMMAND LOCKS AN OBJECT TO THE SCREEN. LOOK IT UP IN THE HELP
lock object on 1

sync

Rem Make bullet
Make Object Sphere 3,1
position object 3,25,31,50
Hide Object 3

rem the matrix
load image "media\grass01.bmp",1

rem Make a simple scene for the camera to look at
make matrix 1,10000.0,10000.0,30,30
load bitmap "media\grass01.bmp",1
get image 1,0,0,256,256
delete bitmap 1
prepare matrix texture 1,1,2,2
randomize matrix 1,295.0

rem Draw aim
cls
Ink RGB(255,0,0),0
Circle Screen Width()/2, Screen Height()/2, 10
Dot Screen Width()/2, Screen Height()/2
sync

rem Position camera
position camera 5000,200,5000

rem Activate manual sync
sync on

rem Begin loop
do

rem the collison for 3d objects
SET GLOBAL COLLISION ON

rem the bullet shooting
if Mouseclick()=1 and BulletLife=0
Position object 3,X#+15,Y#+43.5,Z#
Set object to camera orientation 3
BulletLife=20
Show object 3
Endif

If BulletLife > 0
Dec BulletLife
Move object 3,20
If BulletLife = 0 then Hide object 3
Endif

ammo=10

If mouseclick()=1 and sound playing(1)=0 and ammo>0
ammo=ammo-1
play sound 1
endif

if mouseclick()=2 and sound playing(2)=0
ammo=10
play sound 2
endif
sync

rem Control camera with arrow keys
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#

CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)

Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,CameraAngleY#,10)
ZTest# = Newzvalue(Z#,CameraAngleY#,10)
If XTest#>0 and XTest#0 and ZTest#0 and XTest#0 and ZTest#0 and XTest#0 and ZTest#0 and XTest#0 and ZTest#
Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 10th Feb 2003 04:20
The whole code did not copied even though I remember doing (code) and (/code). Oh well, here is the code in a snippet, like it should have been in the first place:



Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Puffy
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United States
Posted: 10th Feb 2003 04:32
o_O Ok I have some bullet code from a long time ago... hope this helps...



AMD Athlon XP 2100+ OC to 3Ghz/1.5gigs ram/128mb ti4200/120gigs hd/19" monitor/Sound Blaster Audigy Platinum EX/3072kbs Sat Con... I joined in!
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 10th Feb 2003 04:59
That code doesn't work... None of your codes work! lol!

You sure these codes are for DB Classic? Because they just dont work...

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Puffy
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United States
Posted: 10th Feb 2003 05:01
-_- DarkJedi when you ran that code did you happen to push SpaceBar...

AMD Athlon XP 2100+ OC to 3Ghz/1.5gigs ram/128mb ti4200/120gigs hd/19" monitor/Sound Blaster Audigy Platinum EX/3072kbs Sat Con... I joined in!
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 10th Feb 2003 05:12
No I did not push anything. What it does is it loads the game and when it comes time to loading that bullet code it doesnt texture my matrix or anything at all like that, and it gives me an error about either an object or a command already existing. At the bottom of my code it says SYNC. But when I'm loading the game it says command already exists at line blah blah.. So I go see what line blah blah is and I find out that it says my SYNC at the bottom of my main loop already exists. But the only other place there is a sync is above the main loop when I'm loading the gun and matrix and stuff.. Thats it! Oh and for the text at the beginning there is a sync. Thats it! SO I dont get it at all..

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Puffy
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United States
Posted: 10th Feb 2003 05:18
-_- The point was to copy and paste that code... see how it works... and learn from it... not to jack the code... paste it in your program.. and complain about it not working because you dont understand it... o_O clear?

AMD Athlon XP 2100+ OC to 3Ghz/1.5gigs ram/128mb ti4200/120gigs hd/19" monitor/Sound Blaster Audigy Platinum EX/3072kbs Sat Con... I joined in!
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 10th Feb 2003 14:43
I just tried it again and stuff.. And I looked over it for about 10 minutes searching for one main thing in that code... The positioing code. No where in that code does it have a segment to position the gun/bullets. It does have a position object one, but ya wanna know something? That code changes nothing.. Now I am trying to get this code to fit my needs but it doesnt seem to like me...

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 10th Feb 2003 14:45
Never mind, after 15 minutes of looking I found the code. I was looking in the wrong place *gets embarrassed*.. Now I need to find a way to implant it into my game.

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 10th Feb 2003 15:18
Ok, I took out most sounds and the music and stuff and took the media I wanted and made it a zip. I'll upload it later for you to use.

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Puffy
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United States
Posted: 10th Feb 2003 19:56
Not to use... to help fix... O_O and you said implant in your code... o_O if you do that you will never learn... YOU MUST WRITE YOUR OWN CODE...

AMD Athlon XP 2100+ OC to 3Ghz/1.5gigs ram/128mb ti4200/120gigs hd/19" monitor/Sound Blaster Audigy Platinum EX/3072kbs Sat Con... I joined in!
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 10th Feb 2003 23:47
By IMPLANT I mean take the code I modified which was origanly yours, and then place it into my game.. Ya know, coding it into my game.

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Puffy
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United States
Posted: 11th Feb 2003 01:06
Thats not my code... its an example from a long time ago...

AMD Athlon XP 2100+ OC to 3Ghz/1.5gigs ram/128mb ti4200/120gigs hd/19" monitor/Sound Blaster Audigy Platinum EX/3072kbs Sat Con... I joined in!
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 11th Feb 2003 01:25
Yes but you gave it to me. So I said it was yours.

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 11th Feb 2003 06:16
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 11th Feb 2003 14:32
Yes the code works for me too. But I need to figure out how to get a code like that into my game code

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 11th Feb 2003 18:38
read it line by line, your not going to get anywhere unless u apply yourself and know what each line does before u can even drea of splicing it in.

John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 11th Feb 2003 22:51
Yea, I think he doesnt know where it goes in his game. The point wasnt to copy/paste, you read the code, then code somthing simliar by yourself Great way to learn

RPGamer

Current - RPG: Eternal Destiny : Help Wanted!
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 11th Feb 2003 23:36
I stink at learning. I mean, I understand some of it

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 12th Feb 2003 03:18
change that attitude and it will be easier.

think of it as a fun way to explore the commands

Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 12th Feb 2003 03:23
......................................

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 12th Feb 2003 03:24
K then... Expect a week or two of delay for Dark Wars to be coded and finished.

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Puffy
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United States
Posted: 12th Feb 2003 03:38
o_O It will probably take you an hour to figure it out... its not difficult...

AMD Athlon XP 2100+ OC to 3Ghz/1.5gigs ram/128mb ti4200/120gigs hd/19" monitor/Sound Blaster Audigy Platinum EX/3072kbs Sat Con... I joined in!
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 12th Feb 2003 03:51
press f1 over the commands u dont understand

Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 12th Feb 2003 04:05
Oh... I can use that! Btw, it wont take an hour.. It'll defnetly take a day...

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Puffy
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United States
Posted: 13th Feb 2003 03:24
A day is still now a week...

AMD Athlon XP 2100+ OC to 3Ghz/1.5gigs ram/128mb ti4200/120gigs hd/19" monitor/Sound Blaster Audigy Platinum EX/3072kbs Sat Con... I joined in!
Hockey07
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: United States
Posted: 13th Feb 2003 04:19
what u mean?

Current Project: Dark Wars
166 lines of code so far
http://hometown.aol.com/Hockeycow07/rebel.html - The official ReBel Games website!
Murdock743
21
Years of Service
User Offline
Joined: 4th Mar 2003
Location:
Posted: 6th Mar 2003 02:30
I think it means a day to you may be a week or something like that.

Mike Inel
21
Years of Service
User Offline
Joined: 14th Feb 2003
Location: Sa upuan ko po...
Posted: 7th Mar 2003 09:02
You all are getting away from the main topic...(I guess)

.....
xmen
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 7th Mar 2003 15:16
try this just to help can be better


xmen
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 7th Mar 2003 15:20
or this


Login to post a reply

Server time is: 2024-11-24 03:33:47
Your offset time is: 2024-11-24 03:33:47