Door Open

Blitz3D Forums/Blitz3D Beginners Area/Door Open

Well I finnally got it to work. I found a really interesting moving platform program by ; ID: 470
; Author: bradford6
; Date: 2002-10-25 02:33:08
; Title: Moving Platforms demo
; Description: collisions with moving platforms
I really cut every thing out I didn't need until I had my door going up slow and stopping, but can't yet control when it starts. anyway its cool to watch. Today tho' I dumped that for now and finally got Bram32s' idea to work. I don't know if I did it right, but it does work . Press the "E" key and the door goes up slow only so far and then stops. Right now it only goes up.


; Door_opens.bb
; Well its actually a cube lifting up. I didn't know how to provide the media from my juryrigged code, So I borrowed from my 3D Programming for Teens book
;and cobbled this together.
;_______________

Graphics3D 640,480
SetBuffer BackBuffer()

; Create camera
camera=CreateCamera()
PositionEntity camera,0,1,0

; Creating a light

light=CreateLight()
Global doorflag = 0
; Creating the terrain
ground=CreateTerrain(512)
PositionEntity ground, -500,0,-500
EntityColor ground, 0, 235 ,50

door = CreateCube()
PositionEntity door,0,1,10
EntityColor door,200,0,10
; This following code makes our program run

While Not KeyDown( 1 )

If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0
If KeyDown( 203 )=True Then TurnEntity camera,0,1,0
If KeyDown( 208 )=True Then MoveEntity camera,0,0,-0.05
If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.05
If KeyHit(18) = True Then doorflag = 1

If doorflag = 1 MoveEntity door , 0,.01,0
If EntityY(door) >= 3.5 Then doorflag =0: PositionEntity door,0,3.5,10
RenderWorld

Flip
Wend
End


If you can think of any improvments let me know. Thanks for the help