Another Basic Problem Door Open/Shut

Blitz3D Forums/Blitz3D Programming/Another Basic Problem Door Open/Shut

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.

Okay.. Just a couple of more questions on this matter. I was attempting to use the type, because I want many doors in my level.

Here is my code:

Not in the main loop:

Type doorprop
Field status ; the door status
Field speed# ; the speed used to move the door
Field orientation ;x,y,z where the door should move to
Field mesh ;the door model
End Type

In the UpdateGame function (called in the main loop):

For door.doorprop = Each doorprop
Select door\status
Case D_OPENING
;continue To open
opening_door(door)

Case D_CLOSING
;continue To close
closing_door(door)

Case D_CLOSED
;attempt to open the door
open_door(door)

Case D_OPENED
;attempt to close the door
close_door(door)

End Select
Next

Below the above function:

Function opening_door(door.doorprop)
If EntityYaw# (motellcd)<90
doory=1
TurnEntity motellcd,0,doory,0
Else
door\status = D_OPENED
EndIf

End Function

Function closing_door(door.doorprop)
If EntityYaw# (motellcd)>0
doory=-1
TurnEntity motellcd,0,doory,0
Else
door\status = D_CLOSED
EndIf
End Function

Function open_door(door.doorprop)
If KeyHit(18)
If EntityDistance(dummy,motellcd)<10
door\status = D_OPENING
EndIf
EndIf
End Function

Function close_door(door.doorprop)

If KeyHit(18) Then
If EntityDistance(dummy,motellcd)<10
door\status = D_CLOSING
EndIf
EndIf
End Function



And finally in the setup:

motel=LoadAnimMesh( "motel\motellcdsep.3ds")
PositionEntity motel, 0,0,100
ScaleEntity motel, .15,.15,.15
EntityType motel, TYPE_SCENERY, 1
motellcd=FindChild( motel,"LCDDoor" )
door.doorprop = New doorprop
door\status=D_CLOSED

Now there are a couple of things.

1. With this code, nothing happens, I can go up to the door, hit E and nothing happens when it should.

2. Is there a way to have it so that it searches all of the entities within a model that have door or doors with consecutive numbers have the door open action applied to them?

Thank you in advance :).