Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,493 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,704 people online right now. Registration is fast and FREE... Join Now!




blitz3d projectile problem

 
Reply to this topicStart new topic

blitz3d projectile problem, can not get projectiles to leave barell

mr_6_pack
7 Mar, 2008 - 09:23 PM
Post #1

New D.I.C Head
*

Joined: 7 Mar, 2008
Posts: 1

I know this should be easy stuff but somehow I have lost the bullets my gun is suposed to be firing and icant figure what I did wrong. Thanks to anyone that will help

CODE
Graphics3D 640,480
SetBuffer BackBuffer()
light=CreateLight()
type_player=1
type_ground=2
camera=CreateCamera()
PositionEntity camera,0,10,0
EntityType camera,type_player

sky=CreateSphere(64)
FlipMesh sky
ScaleEntity sky,1000,1000,1000
PositionEntity sky,0,0,0
sky_tex=LoadTexture("sky.jpg")
EntityTexture sky,sky_tex
EntityFX sky,1

terrain=LoadTerrain("mt.jpg")
ScaleEntity terrain,10,100,5
PositionEntity terrain,-500,0,-500
tex=LoadTexture("grass1.jpg")
ScaleTexture tex,50,50
EntityTexture terrain,tex
EntityType terrain, type_ground

gun=LoadMesh("a3dshtgn.3ds")
guntex=LoadTexture("shtgn.jpeg")
EntityTexture gun,guntex
PositionEntity gun,-340,1,45
RotateMesh gun,10,177,360
EntityParent gun,camera
EntityType gun, type_player
EntityOrder gun,-1


fullcart=100
Dim bullet(fullcart)
For i=0 To fullcart
bullet(i)=CreateSphere()
EntityColor bullet(i) ,100,100,100
ScaleEntity bullet(i) ,0.2,0.4,0.2
HideEntity bullet(i)
Next

While Not KeyDown(1)
x#=0
y#=0
z#=0

If KeyHit(57) And reload=0 Then
ShowEntity bullet(T)
PositionEntity bullet(t) ,EntityX(camera,1),EntityY(camera,1),EntityZ(camera,1)
RotateEntity bullet(t),EntityPitch#(gun,1)-35,EntityYaw#(gun,1),EntityRoll#(gun,1)
t=t+1
EndIf

For q=0 To fullcart
MoveEntity bullet(q),0,1,3
Next

If KeyDown(203)=True Then x#=-0.5
If KeyDown(205)=True Then x#=0.5
If KeyDown(208)=True Then z#=-0.5
If KeyDown(200)=True Then z#=0.5
MoveEntity camera,x#,y#,z#

Collisions type_player,type_ground,2,2
Collisions type_ground,type_player,2,2

UpdateWorld
bulletcount=100-t


If t=100 Then
t=1
reload=1
EndIf

If KeyDown(19)=True Then
t=1
reload=0
EndIf

RenderWorld
Color 0,0,0
Text 2,100,"x= "+EntityX(camera)+" z= "+EntityZ(camera),False,False
Text 2,50,"x "+EntityX(gun)+" z "+EntityZ(gun),False,False
Text 0,15,"bullets Remaining: "+bulletcount
If reload=1 Then Text GraphicsWidth()/2,GraphicsHeight()/2,"press R to reload",1,1
Flip

Wend

End

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 07:51PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month