mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
work on doors while moving
This commit is contained in:
@@ -173,22 +173,21 @@ local function ElevatorDoorsAnimation(self: ClassConstructor, opening: boolean?,
|
||||
local ElevatorDoor2_P: Vector3 = self.ElevatorDoor2.Position
|
||||
|
||||
if opening then
|
||||
--This is mega cringe but the doors can open while the elevator is moving
|
||||
local Alpha = 0
|
||||
local P1 = (ElevatorDoor1_P+Doors.Door1Stopped_X).X
|
||||
local P2 = (ElevatorDoor2_P+Doors.Door2Stopped_X).X
|
||||
--This is mega cringe but the doors can open while the elevator is moving now
|
||||
local StartTime = os.clock()
|
||||
local Timing = 2
|
||||
|
||||
while task.wait() do
|
||||
Alpha+=.001
|
||||
local Time = math.clamp((os.clock()-StartTime)/Timing, 0, 1)
|
||||
|
||||
local Door1OpenVector = Vector3.new(P1, self.ElevatorDoor1.Position.Y, self.ElevatorDoor1.Position.Z)
|
||||
local Door2OpenVector = Vector3.new(P2, self.ElevatorDoor2.Position.Y, self.ElevatorDoor2.Position.Z)
|
||||
local ElevatorBoxY = Vector3.new(0, self.ElevatorBox.Position.Y, 0)
|
||||
local Door1Vector = Vector3.new(ElevatorDoor1_P.X, 0, ElevatorDoor1_P.Z)
|
||||
local Door2Vector = Vector3.new(ElevatorDoor2_P.X, 0, ElevatorDoor2_P.Z)
|
||||
|
||||
self.ElevatorDoor1.Position = self.ElevatorDoor1.Position:Lerp(Door1OpenVector, Alpha)
|
||||
self.ElevatorDoor2.Position = self.ElevatorDoor2.Position:Lerp(Door2OpenVector, Alpha)
|
||||
self.ElevatorDoor1.Position = ElevatorBoxY+ElevatorDoor1_P:Lerp(Door1Vector+Doors.Door1Stopped_X, Time)
|
||||
self.ElevatorDoor2.Position = ElevatorBoxY+ElevatorDoor2_P:Lerp(Door2Vector+Doors.Door2Stopped_X, Time)
|
||||
|
||||
print(Alpha)
|
||||
if Alpha>=1 then
|
||||
if Time>=1 then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
@@ -246,7 +246,6 @@ function Otis1960:__MoveFloors(GoalLevelVEC, RequestedLevel, GoingUp)
|
||||
FloorLeveling(self, RequestedLevel)
|
||||
|
||||
if ElevatorPositionY>=BoxAlignY-Otis1960.DoorOpeningDistance and not DoorsOpeningEvent then
|
||||
print("fired")
|
||||
DoorsOpeningEvent = true
|
||||
self.ElevatorDoors:ToggleElevatorDoors(true, RequestedLevel)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user