need to open a door

Blitz3D Forums/Blitz3D Beginners Area/need to open a door

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.

Ok i got the door to open using this code
Graphics3D 800,600,0,1

SetBuffer BackBuffer()

Global campivot
Global cam_col=1
Global room_col=2
Global door_col=3
Global door
Global door_open = False
Global door_y
Global door_opened = False

Collisions Cam_col,room_col,2,2
Collisions cam_col,door_col,2,2

doorstate = 0 ; 0=door closed, 1=door opening, 2=door open, 3=door closing
doormove# = 0 
doortimeopen = 2000 ; time door stays open


light=CreateLight()

room=LoadMesh ("cube1.b3d")
PositionEntity room,0,-100,0
EntityType room,room_col

door=LoadMesh ("door.b3d")
PositionEntity door,0,-100,200
ScaleEntity door,1,1,.3
EntityType door,door_col

campivot=CreatePivot()
EntityType campivot,cam_col
EntityRadius campivot,4

camera=CreateCamera(campivot)
PositionEntity camera,EntityX(campivot),50,EntityZ(campivot)
EntityType camera,cam_col	


Repeat

	TranslateEntity campivot,0,-.5,0

	If KeyDown (203)
				TurnEntity campivot,0,1,0
		ElseIf KeyDown (205)
				TurnEntity campivot,0,-1,0
				End If
		If KeyDown (208)
				TurnEntity camera,1,0,0				 
		ElseIf KeyDown (200)
				TurnEntity camera,-1,0,0
				EndIf
		If KeyDown (30)
				MoveEntity campivot,0,0,1
		ElseIf KeyDown (44)
				MoveEntity campivot,0,0,-1
				EndIf
				
Select doorstate
	Case 0
		If EntityCollided (campivot,door_col) Then doorstate =1
	Case 1 ;door opening
		MoveEntity door,0,1,0
		doormove =EntityY(door)
		If doormove >= 50 Then MoveEntity door,0,0,0 :doorstate =2 EntityType door, 0:doorclosetime=MilliSecs()+doortimeopen
	Case 2 ;open
		If MilliSecs > doorclosetime Then doorstate=3
	Case 3 ;closeing
		MoveEntity door,0,-1,0
		doormove =EntityY(door)
		If doormove <= 0 Then MoveEntity door,0,0,0:doorstate=0:EntityType door,3
End Select

UpdateWorld

RenderWorld
Flip



now just got to get it to shut. I will play around with it & see what i can do.