Let's make a B3D game ...

Miscellaneous Forums/General Discussion/Let's make a B3D game ...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I am sorry, I dont know how to add it has a code.


;====== FORUM GAME =========================================
;====== JEREMY ALESSI 9-25-2006 ============================

;====== INITIALIZE =========================================

Graphics3D( 640, 480, 0, 2 )
SetBuffer BackBuffer()
SeedRnd MilliSecs()

;====== GAME INIT ============
TimingLevel = 200
;==================

Global camera = CreateCamera()

;What does sceneMember mean?
Type sceneMember

Field eHandle ;Entity Handle

End Type

Type IProjectile
Field Id
Field Projectile
Field Speed#
;add timelife to auto deletation
End Type

MoveEntity camera, 0, 0, -11

Ship = CreateCube(camera)
MoveEntity Ship, 0, -2, 5

;====== MAIN LOOP =========================================

While Not KeyDown(1)
Cls

;Control the camera
If KeyDown(200) Then MoveEntity camera, 0, 0, 1
If KeyDown(208) Then MoveEntity camera, 0, 0, -1

If KeyDown(017) Then MoveEntity camera, 0, 1, 0
If KeyDown(031) Then MoveEntity camera, 0, -1,0

If KeyDown(030) Then MoveEntity camera,-1, 0, 0
If KeyDown(032) Then MoveEntity camera, 1, 0, 0

;Add a Projectile
If MilliSecs() > DelayShot Then
DelayShot = MilliSecs() + TimingLevel ;compute next delay
TimingLevel = TimingLevel - 5 ; reduce the delay to the next shot.
Projectile_Create()
End If

Projectile_Update()

UpdateWorld
RenderWorld
Flip

Delay 1
Wend

; Start: Where do you want to go today? errr... Wrong Quote.

;===========================================================

Function Projectile_Create()
T.IProjectile = New IProjectile

IdGenIProjectile = IdGenIProjectile + 1
T\ Id = IProjectile

T\ Projectile = CreateCube()
PositionEntity T\ Projectile, 0 ,0 ,20
ScaleEntity T\ Projectile, .1, .1, 4
PointEntity T\ Projectile, camera
TurnEntity T\ Projectile, Rnd(-10,10), Rnd(-10,10), Rnd(-10,10)

T\ Speed# = 0.3
End Function
Function Projectile_Update()
For T.IProjectile = Each IProjectile
MoveEntity T\ Projectile, 0, 0, T\ Speed#
Next
End Function
Function Projectile_Delete( Id )
;Todo
End Function