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.

DarkBASIC Discussion / Very basic fps troubles bullet always stops. and Cant get a accurate shot!

Author
Message
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 2nd Nov 2008 19:44
Ok so i have a very simple fps (just started) and i have a automatic gun and a small sphere that will follow me around the map (like i said very simple) but wen i shoot the bullets stop after moving for a certain amount of time. and i cant get a very accurate shot

here is my mouseclick code

[If mouseclick()=1
if bullet<150 and bullet>99
bullet=bullet+1
positin object b#,X#,Y#,Z#
set object to camera orientation b#
show object b#
play sound 1
Gosub shootbullet
endif
endif]

Here is the Gosub Part

[Shootbullet:
dec bullet life
move object b#,300

bX#=object position X(b#)
bY#=object position Y(B#)
bZ#=object position Z(b#)

if bX#>1000 or bX#<0 or bY#>1000 or bY#<0 or bZ#>1000 or bZ#<0
bulletlife=0
endif

if bY#<get ground height(1,bY#,bZ#) then bulletlife=0

if object collision(b#,0)>0
bulletlife=0
endif

if bulletlife=0
hide object b#
endif

return]

Can anyone help?????
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 2nd Nov 2008 22:24
Quote: "positin object b#,X#,Y#,Z#"

Typo.

Quote: "dec bullet life"

You can't have a variable with a space in it; try either "bullet_life" or "BulletLife".

When does the b# variable change?

A small program that works is better than a large one that doesn't.

DBC Challenge Rank: Rookie
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 3rd Nov 2008 02:13
this could be a very bad way of doing it but wen bullet>99 it will make b#=bullet

Heres the hole thing(attachment)

Attachments

Login to view attachments
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 3rd Nov 2008 02:14
this could be a very bad way of doing it but wen bullet>99 it will make b#=bullet

Heres the hole thing(attachment)

Some things could be useless in the code i was working on a few things and i'm not sure if i got all of it out. i didnt send all the media though if you need it then i can send it

Attachments

Login to view attachments
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 3rd Nov 2008 02:16
oh and the "bullet life" was a typo it was supposed to be bulletlife

Login to post a reply

Server time is: 2025-06-07 08:30:19
Your offset time is: 2025-06-07 08:30:19