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 / shoot an reload

Author
Message
look i am a newb
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location:
Posted: 31st Jan 2004 00:54
how do u shoot with many bullits (not one that moves back to the player) and reload when a clip hits 0?
--thank you for any help
Doremar
20
Years of Service
User Offline
Joined: 30th Dec 2003
Location:
Posted: 31st Jan 2004 01:16
I'd declare a variable for bullets, say like b=100 and every time you fire decrement b by one:
When i=0, don't allow the player to fire, play a *click* sound instead or something, then just watch for a keypress (like "R") to reload and reset b to 100.

In pseudo code minus the details since you didn't give any :
b=100
if pulltrigger=1
if b>0
dec b,1
play firing sound/animation
endif
if b=0 then play click sound
endif
if keystate(whatever the heck R is)=1
b=100
play reload sound/animation

Clear as mud?

A Cloaking Robe of Elven-Kind hangs in my wardrobe behind
All those things that mother said were proper for a boy
look i am a newb
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location:
Posted: 31st Jan 2004 01:23
Rem Shoot bullet
if Mouseclick()=1 and Ammo >0
Position object 2,X#,Y#+43,Z#
Set object to camera orientation 2
BulletLife =25
Ammo -1
show object 2
Loop sound 2
Endif

If BulletLife > 0
Dec BulletLife
Move object 2,20
bX#=Object position X(2)
bY#=Object position Y(2)
bZ#=Object position Z(2)
Position sound 2,bX#,bY#,bZ#

if BulletLife = 0
Hide object 2
stop sound 2
endif
Endif
----
thats what iv been using
Doremar
20
Years of Service
User Offline
Joined: 30th Dec 2003
Location:
Posted: 31st Jan 2004 01:44
Try this...

A Cloaking Robe of Elven-Kind hangs in my wardrobe behind
All those things that mother said were proper for a boy
look i am a newb
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location:
Posted: 31st Jan 2004 02:38
got a nesting error
i'v been playing around with it have no clue
---
so far whole game code
---
rem Make a simple scene for the camera to look at
make matrix 1,10000.0,10000.0,25,25
load bitmap "floor1.bmp",1
get image 1,0,0,256,256
delete bitmap 1
prepare matrix texture 1,1,2,2
randomize matrix 1,50.0
set matrix height 1,12,12,300.0
update matrix 1

rem Create blob character to follow
make object sphere 1,50.0

Rem Make bullet
Make Object Sphere 4,2
Hide Object 4
rem Set variables for character position
x#=500
z#=500

rem Activate manual sync
sync on

rem Begin loop
do

rem Control camera with arrow keys
if upkey()=1 then x#=newxvalue(x#,a#,10) : z#=newzvalue(z#,a#,10)
if downkey()=1 then x#=newxvalue(x#,a#,-10) : z#=newzvalue(z#,a#,-10)
if leftkey()=1 then a#=wrapvalue(a#-10.0)
if rightkey()=1 then a#=wrapvalue(a#+10.0)


if Mouseclick()=1 and BulletLife=0
Position object 4,X#,Y#+43,Z#

BulletLife =25
show object 4
Endif



If BulletLife > 0
Dec BulletLife
Move object 4,60
if BulletLife = 0 then Hide object 4
Endif


rem Update character
y#=get ground height(1,x#,z#)+50.0
position object 1,x#,y#,z#
yrotate object 1,a#

rem Position camera to the back of the character
cx#=newxvalue(x#,wrapvalue(a#+180),300)
cz#=newzvalue(z#,wrapvalue(a#+180),300)
cy#=get ground height(1,cx#,cz#)+100.0
position camera cx#,cy#,cz#

rem Point camera at object
point camera x#,y#,z#

rem Syncronise
sync

rem End loop
loop
Doremar
20
Years of Service
User Offline
Joined: 30th Dec 2003
Location:
Posted: 31st Jan 2004 02:51
if keystate(19)=1
Ammo=10
play sound (reload)
Endif <--------------------------- sorry, I missed this endif

A Cloaking Robe of Elven-Kind hangs in my wardrobe behind
All those things that mother said were proper for a boy
look i am a newb
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location:
Posted: 31st Jan 2004 03:19
run time error at line 120. sound number range is 1 to 1024.
----
also Ammo -1 has to be Ammo=Ammo-1 (i learned something )
Doremar
20
Years of Service
User Offline
Joined: 30th Dec 2003
Location:
Posted: 31st Jan 2004 03:37
Er, well you need sounds for reload and click and stuff silly =)

A Cloaking Robe of Elven-Kind hangs in my wardrobe behind
All those things that mother said were proper for a boy
look i am a newb
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location:
Posted: 31st Jan 2004 03:41
my fault forgot to paste the error part.
Quote: "if keystate(19)=1"
look i am a newb
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location:
Posted: 3rd Feb 2004 22:50
still need help
mm0zct
20
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 4th Feb 2004 02:11
use the bullet object from the count down:
rem create bullet if it doesn't exist
if object exist(bullet+b)=1 then create cube (bullet+b), 2

then use the fire bullet stuff using:
object(bullet+b)


someone else can explain this to you or email/msn message me if they can't

http://www.larinar.tk
AMD athlon thoroughbred 2200, 512Mb ram, 40Gb HD, ati saphire radeon 9600 atlantis w/128mb ddr ram, good creative-labs soundcard, cd-rw + dvd drives.
Uber Krystoff
20
Years of Service
User Offline
Joined: 3rd Feb 2004
Location:
Posted: 4th Feb 2004 03:03
Hmmmm about the shoot/reload thing. I would say that its more efficient to have all data about the gun in an array. This way its very easy to carry lots of differnet guns all with different statistics.

#identifying type of gun | amount of ammo in gun | other attributes...

The original attributes for each gun like clip size and gun name, if it has a scope how much that scope zooms etc can all be a different array and when you need to reload you grab the value from the original array.

256k ought to be enough for anybody
-Bill Gates
look i am a newb
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location:
Posted: 6th Feb 2004 02:16
i just need a example for that muti bullits stuff. i already have a code that i made for muti guns, very easy to.
like when G=1 (what the gun is)
B=1 (wha bullit it is)
ect. though the code is more then that

Login to post a reply

Server time is: 2024-09-21 20:43:54
Your offset time is: 2024-09-21 20:43:54