does any body have some bullet code for a first person shooter
wot im after is the bullet to start from the end of the gun and shhot towards the gun sight here is my code sofar
Graphics3D 640,480,32,1
SetBuffer BackBuffer()
camera=CreateCamera()
PositionEntity camera,0,1,0
light=CreateLight()
RotateEntity light,90,0,0
gun=CreateCube(camera):ScaleEntity gun,5,5,15
;gun=LoadMesh("deagle.3ds")
PositionEntity gun,30,-40,50
RotateEntity gun,-1,3,-1
EntityType gun,2
EntityParent gun,camera
EntityRadius gun,1
EntityOrder gun,-1
; Create terrain
terrain=CreateTerrain(512)
; Texture terrain
tex=LoadTexture( "wall8.jpg" )
EntityTexture terrain,tex
ScaleEntity terrain,100,100,100
MouseSensitivity# = 2
MoveMouse GraphicsWidth() / 2, GraphicsHeight() / 2
FlushMouse
While Not KeyDown( 1 )
dx# = dx# + MouseYSpeed() / MouseSensitivity#
dy# = dy# - MouseXSpeed() / MouseSensitivity#
If dx# > 85 Then dx# = 85 ElseIf dx# < -85 dx# = -85
xang# = CurveValue#(xang#, dx#, 3.5)
yang# = CurveValue#(yang#, dy#, 3.5)
RotateEntity (Camera), xang#, yang#, 0
MoveMouse GraphicsWidth() / 2, GraphicsHeight() / 2
If MouseDown(1)=1 Then speed#=speed#+.2
speed#=speed#*.9 ; friction
If MouseDown(3)=1
zoom#=zoom#+1
MouseSensitivity# = 6
EndIf
If MouseDown(3)=0
zoom#=zoom#-1
MouseSensitivity# = 2
EndIf
If zoom#<1 Then zoom#=1
If zoom#>10 Then zoom#=10
; Set camera zoom
CameraZoom camera,zoom#
MoveEntity camera,0,0,speed#
xpos#=EntityX(camera)
zpos#=EntityZ(camera)
ypos#=TerrainY(terrain,xpos,0,zpos)
PositionEntity camera,xpos,ypos+20,zpos
MoveMouse 320,240
RenderWorld
mx=MouseX()
my=MouseY()
Oval mx-10,my-10,20,20,0
Plot mx,my
Flip
Wend
End
Function CurveValue#(Current#, Destination#, Curve#)
Return Current# + ((Destination# - Current#) / Curve#)
End Function
any help?
Thanks
GIMPY :)
wot im after is the bullet to start from the end of the gun and shhot towards the gun sight here is my code sofar
Graphics3D 640,480,32,1
SetBuffer BackBuffer()
camera=CreateCamera()
PositionEntity camera,0,1,0
light=CreateLight()
RotateEntity light,90,0,0
gun=CreateCube(camera):ScaleEntity gun,5,5,15
;gun=LoadMesh("deagle.3ds")
PositionEntity gun,30,-40,50
RotateEntity gun,-1,3,-1
EntityType gun,2
EntityParent gun,camera
EntityRadius gun,1
EntityOrder gun,-1
; Create terrain
terrain=CreateTerrain(512)
; Texture terrain
tex=LoadTexture( "wall8.jpg" )
EntityTexture terrain,tex
ScaleEntity terrain,100,100,100
MouseSensitivity# = 2
MoveMouse GraphicsWidth() / 2, GraphicsHeight() / 2
FlushMouse
While Not KeyDown( 1 )
dx# = dx# + MouseYSpeed() / MouseSensitivity#
dy# = dy# - MouseXSpeed() / MouseSensitivity#
If dx# > 85 Then dx# = 85 ElseIf dx# < -85 dx# = -85
xang# = CurveValue#(xang#, dx#, 3.5)
yang# = CurveValue#(yang#, dy#, 3.5)
RotateEntity (Camera), xang#, yang#, 0
MoveMouse GraphicsWidth() / 2, GraphicsHeight() / 2
If MouseDown(1)=1 Then speed#=speed#+.2
speed#=speed#*.9 ; friction
If MouseDown(3)=1
zoom#=zoom#+1
MouseSensitivity# = 6
EndIf
If MouseDown(3)=0
zoom#=zoom#-1
MouseSensitivity# = 2
EndIf
If zoom#<1 Then zoom#=1
If zoom#>10 Then zoom#=10
; Set camera zoom
CameraZoom camera,zoom#
MoveEntity camera,0,0,speed#
xpos#=EntityX(camera)
zpos#=EntityZ(camera)
ypos#=TerrainY(terrain,xpos,0,zpos)
PositionEntity camera,xpos,ypos+20,zpos
MoveMouse 320,240
RenderWorld
mx=MouseX()
my=MouseY()
Oval mx-10,my-10,20,20,0
Plot mx,my
Flip
Wend
End
Function CurveValue#(Current#, Destination#, Curve#)
Return Current# + ((Destination# - Current#) / Curve#)
End Function
any help?
Thanks
GIMPY :)