Firing

Blitz3D Forums/Blitz3D Beginners Area/Firing

patisawesome(Posted 2003) [#1]
How do you create a bullet and make it fly out of a gun?
-me


Beaker(Posted 2003) [#2]
bullet = CreateCube()
While EntityZ(bullet)<40
MoveEntity bullet,0,0,1
Wend



Rob(Posted 2003) [#3]
Lets start with something like a test area. Because you are new to 3D, you need to actually look at what is going on.

Why not make a gun and a bullet. Show them on the screen and post back here. I will then show you how to fire the bullet from the gun. [edit]: the avarice of beaker fires sooth.


Ross C(Posted 2003) [#4]
First i would set up a type collection fro your bullets

type bullet
   field x,y,z
   field entity
   field speed
   field power
end type


something like that for a basic bullet. Everytime a bullet is fired, create a new type object, and copy the bullet mesh into the entity field. Set the bullet to the location of the gun and make sure it is rotated correctly.

Then give the bullet a speed and power. Have a seperate function for cycling through all of your bullet objects: Updating their location, checking for collisions and such.

Hope some of that helps :)


Jim Teeuwen(Posted 2003) [#5]
*The mighty codearchive stirres its head and roars "USE ME"*


patisawesome(Posted 2003) [#6]
Here's the "test area":

Graphics3D 640,480,16,1

Type bullet
Field b,time,bull
End Type

Global time=100
cam=CreateCamera()
PositionEntity cam,0,1,1
CameraClsColor cam,0,200,255

gun=CreateCube()
PositionEntity gun,5,-1,10
ScaleEntity gun,0.5,0.5,2.5
TurnEntity gun,0,90,0
EntityColor gun,20,20,20

ground=CreateCube()
ScaleEntity ground,30,0.5,30
PositionEntity ground,0,-2,10

b=CreateCylinder()
ScaleEntity b,0.1,0.1,0.1
TurnEntity b,90,90,0
HideEntity b

l=CreateLight()
TurnEntity l,45,45,0

While Not KeyHit(1)

UpdateWorld
RenderWorld
Flip
Wend

End



edit:Help!


patisawesome(Posted 2003) [#7]
IF help=0
help_needed()
EndIf
-me


puki(Posted 2003) [#8]
"patisawesome" This all seems to be for your "StormDimension" FPS project (Realistic Lighting/Acid/First Person Cam/Collision Detection/Gravity/FullScreen/Greate Models!) That's a complex project. How far have you got?


patisawesome(Posted 2003) [#9]
There's 137 rows not counting "End".
-me


puki(Posted 2003) [#10]
Other than the one you posted, have you got a working test area/level/environment and camera movement that you are happy with - ie. textured - different areas/stairs, etc?


patisawesome(Posted 2003) [#11]
I don't have any stairs yet, I also took off the door.(I'll add another one sometime). I've got the rest, not counting areas.(I'm not quite sure what you mean about "areas")
-me


puki(Posted 2003) [#12]
Is it a BSP level, a 3d model or have you just created it out of simple objects from within blitz? Is it textured with graphics?


puki(Posted 2003) [#13]
You haven't replied - Have you seen Mark's BSP demo (the one with his "mario-like" character that you control in 3rd person in a QuakeIII level)? If you want I could strip it out and replace the third person camera and replace it with a normal first person one (so it plays quake-like) - this is a good level as it has various areas and stairs.


puki(Posted 2003) [#14]
"patisawesome" - you are just bogging yourself down by trying to make it do everything a commercial FPS does, plus working on your own modeller too!!. Plus, you have a habit of submitting posts that are a bit brief as to what you want to do and also where the answer is sometimes a huge subject. At the moment, you are trying to add head-bobbing, gravity, bullets, AI, etc, all at the same time.


patisawesome(Posted 2003) [#15]
...
-me


puki(Posted 2003) [#16]
"patisawesome" I'm signing off now for time-difference reasons - it's getting on for 12:30am GMT. Mark's code was called "bspdemo" - search your hard drive "bspdemo*" to see if you have it. I'm not sure where it is currently located and you will need the textures.

In the meantime, if anyone knows where Mark's BSP demo is currently located, can they let "patisawesome" know. I'm going to bed and won't be back here for probably 15+ hours.


Zethrax(Posted 2003) [#17]
One thing I would recommend is that you only process the first collision encountered on the bullets collision list. Usually there will only be one genuine collision anyway, and Blitz's collision system has a tendency to occasionally register extra collisions when two moving collision spheres/ellipsoids hit each other, so you might end up having your bullets applying extra hurt damage.


puki(Posted 2003) [#18]
"patisawesome" Have a look at/play with some of the demos on your Blitz3d disk in your "Blitz 3D samples" folder:
si\fps\fps.bb
zenith\scare\scare.bb
Misc\FPS\fps.bb
Open DNA\Moving Targets\shooter.bb


patisawesome(Posted 2003) [#19]
I have. None of them help me.
-me


GameCoder(Posted 2003) [#20]
why dont you just use the makehalflife2engine() function. It works perfactlt for me. :D


DarkEagle(Posted 2003) [#21]
http://www.blitzcoder.com/cgi-bin/ubb-cgi/postdisplay.cgi?forum=Forum5&topic=002489


patisawesome(Posted 2003) [#22]
I don't use functions.:(

-me


Gabriel(Posted 2003) [#23]
I don't use functions


That's gonna put a serious dent in your programming, considering that 90% of Blitz's engine relies upon functions. I guess you're going to write your own?


patisawesome(Posted 2003) [#24]
Part of the reason is that I can't get them to work.
-me


GameCoder(Posted 2003) [#25]
Thin of a function this way. Its a peice of code that can be used anywhere without the need for you to type it again. All you have to do is make a call to it. In one of your games put all the code for moving an object inbetween this


function move()

--(Put all code here)

end function



then in your main loop make a call to the function like this


move()



That way you have a function called move that gets called in the main loop of your program :)


patisawesome(Posted 2003) [#26]
How do I code a function that creates a bullet?
-me


Ross C(Posted 2003) [#27]
Seriously Pat, I think you really should start with something alot simplier, Like getting a camera to move around using the arrow key or something. I'm not being nasty, but the experience you pick up from doing small things like that, add to your understanding of things.

They will give you an idea of how to do something similar and maybe more advanced. Don't jump in at the deep end :)