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