Trying to convert a game written in DBP to VB, having problems on the shooting portion. It just doesn't do anything when I press the spacebar, I know that its receiving the input though because I tested it. I'm open to other methods, i'm not too fond of this one since it will be multiplayer and i'll have to track bullets on all clients...so i'm open to suggestions on this. This just happens to be the only way I know how.
DB Code:
createbullets:
`---------- CREATE STANDARD BULLETS
bullet_count = 1000
bullet_max = 1020
bullet_times = 0
bullet_timee = 10
dim bullet_life(2000)
bullet_end = 100
bullet_speed = 25
load image "Ships/bullet4.jpg",1000
for a = 1000 to bullet_max
make object sphere a,40
`make object plain a,50,50
texture object a,1000
set object light a,0
ghost object on a
fade object a,100
hide object a
bullet_life(a) = 0
position object a,0,999999,0
next a
return
if spacekey() = 1
inc bullet_times
if bullet_times > bullet_timee
bullet_times = 0
inc bullet_count
if bullet_count > bullet_max then bullet_count = 1000
if object visible(bullet_count) = 0
position object bullet_count, px#, py#, pz#
play sound 2
point object bullet_count, limb position x(20,0), limb position y(20,0), limb position z(20,0)
show object bullet_count
endif
endif
endif
for a = 1000 to bullet_max
if object visible(a) = 1
move object a,bullet_speed
inc bullet_life(a)
next a
VB Code:
Public Sub InitLaser()
COUNT = 1000
MAX = 1020
TIMES = 0
TIMEE = 10
LIFE = 2000
BEND = 100
BSPEED = 10
oDBImage.LoadImage("ships/fighter/bullet2.jpg", 25000)
'LOAD SOUND HERE
For A = 1000 To MAX
oDB3D.MakeObjectSphereB(A, 40)
oDB3D.TextureObject(A, 25000)
oDB3D.SetObjectLight(A, 0)
oDB3D.GhostObjectOn(A)
oDB3D.FadeObject(A, 100)
' oDB3D.HideObject(A)
LIFE = 0
' oDB3D.PositionObject(A, 0, 999999, 0)
oDB3D.PositionObject(A, 50000, 10000, 50000)
Next
End Sub
Public Sub FireLaser()
If oDBInput.SpaceKey = 1 Then
TIMES = TIMES + 1
If TIMES > TIMEE Then
TIMES = 0
COUNT = COUNT + 1
If COUNT > MAX Then COUNT = 1000
If oDB3D.ObjectVisible(COUNT) = 0 Then
oDB3D.PositionObject(COUNT, px, py, pz)
'playsound
oDB3D.PointObject(COUNT, oDB3D.LimbPositionX(20, 0), oDB3D.LimbPositionY(20, 0), oDB3D.LimbPositionZ(20, 0))
oDB3D.ShowObject(COUNT)
End If
End If
End If
For A = 1000 To MAX
If oDB3D.ObjectVisible(A) = 1 Then
oDB3D.MoveObject(A, BSPEED)
LIFE = LIFE + 1
oDB3D.HideObject(A)
oDBText.Text(10, 95, IMAGES)
End If
Next
End Sub