Playing an animation for opening a door

Blitz3D Forums/Blitz3D Programming/Playing an animation for opening 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.

Hmm sounds like a case for states

Or good ole Select Case of state in this case. hehe, err sorry.

Simply have a state variable that gets set for each step then feed that into a select case, in this instance 2 steps with the first state set by entering the hotspot.

Global doorstate = 0  ; not waiting for a door to open

If ((playerx=-287) And (playery=5) And (playerz > 229) And (playerz<250)) Then
   doorstate = 1
End If
doortest()

Function doortest()
    If doorstate = 0 Then
       Return
    Else
       Select doorstate
            Case 1:  ;start player animation at door
                 Animate player_hero,3,10,7
                 doorstate = 2
                 Return
            Case 2:  ; ok see if still animating
                 If Not Animating(player)Then
                     ; if not start opening door
                      doorstate = 0
                       For door1_number#=1 To 90 Step 0.1                  
                         RotateEntity door1,0,door1_number#,0
                       Next

                 EndIf
                 Return
			Default
     End Select
   End If
End Function



Well not sure if this will run, But I think it will give the idea.

Oh yea and if doorstate is not 0 then dont allow player controls.