Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
max-bacon committed Aug 12, 2023
1 parent 2369b56 commit dceab4d
Show file tree
Hide file tree
Showing 11 changed files with 328 additions and 197 deletions.
Binary file modified .lune/map.rbxl
Binary file not shown.
Binary file modified assets/Workspace/Extras.rbxm
Binary file not shown.
Binary file modified assets/Workspace/Model18.rbxm
Binary file not shown.
Binary file modified assets/Workspace/Model22.rbxm
Binary file not shown.
Binary file modified assets/Workspace/Model9.rbxm
Binary file not shown.
Binary file modified assets/Workspace/Obstacles.rbxm
Binary file not shown.
339 changes: 186 additions & 153 deletions sourcemap.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions src/Server/Components/DashingStoneStatue.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

local EmitterMonster = require(script.Parent.EmitterMonster)
local Component = require(ReplicatedStorage.Packages.Component) :: any
local Promise = require(ReplicatedStorage.Packages.Promise) :: any
local Trove = require(ReplicatedStorage.Packages.Trove)
Expand Down Expand Up @@ -43,6 +40,8 @@ function DashingStoneStatue:Start()
running = false
end

self.Instance.StoneStatue.PrimaryPart.CFrame = CFrame.new(self.Instance["1"].Position) * self.Instance.StoneStatue.PrimaryPart.CFrame.Rotation

local startCFrame = self.Instance.StoneStatue.PrimaryPart.CFrame
local nextStopCFrame = CFrame.new(self.Instance["2"].Position) * startCFrame.Rotation
local firstRotationCFrame = nextStopCFrame * CFrame.Angles(math.rad(180), 0, 0)
Expand Down
97 changes: 97 additions & 0 deletions src/Server/Components/MovingPlatform.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

local Component = require(ReplicatedStorage.Packages.Component) :: any
local Promise = require(ReplicatedStorage.Packages.Promise) :: any
local Trove = require(ReplicatedStorage.Packages.Trove)

local MOVE_TIME = 5
local MOVE_DELAY_TIME = 0.5
local CHANGE_VELO_DELAY = 0.5

local MovingPlatform = Component.new({
Tag = "MovingPlatform",
})

function MovingPlatform:Construct()
self._trove = Trove.new()

self._assemblyVeloAlter = Vector3.new()
end

function MovingPlatform:Start()
--- Run the movement of the platform
self._trove:Add(Promise.new(function(_, _, onCancel)
local running = true

if onCancel() then
running = false
end

self.Instance.PrimaryPart.CFrame = CFrame.new(self.Instance["1"].Position)
* self.Instance.PrimaryPart.CFrame.Rotation

local firstTween = TweenService:Create(
self.Instance.PrimaryPart,
TweenInfo.new(MOVE_TIME, Enum.EasingStyle.Linear),
{ CFrame = CFrame.new(self.Instance["2"].Position) * self.Instance.PrimaryPart.CFrame.Rotation }
)

local secondTween = TweenService:Create(
self.Instance.PrimaryPart,
TweenInfo.new(MOVE_TIME, Enum.EasingStyle.Linear),
{ CFrame = CFrame.new(self.Instance["1"].Position) * self.Instance.PrimaryPart.CFrame.Rotation }
)

while running do
firstTween:Play()
firstTween.Completed:Wait()

task.wait(MOVE_DELAY_TIME)

secondTween:Play()
secondTween.Completed:Wait()

task.wait(MOVE_DELAY_TIME)
end
end).cancel)

--- Make it more difficult with random changes
self._trove:Add(Promise.new(function(_, _, onCancel)
local running = true

if onCancel() then
running = false
end

while running do
self._assemblyVeloAlter = Vector3.new(math.random(1, 3), 0, math.random(1, 3))
task.wait(CHANGE_VELO_DELAY)
end
end).cancel)

--- Allow for the player to move with platform
self._trove:Add(Promise.new(function(_, _, onCancel)
local lastPos = self.Instance.PrimaryPart.Position

local con = RunService.Stepped:Connect(function(_, dt)
local currentPos = self.Instance.PrimaryPart.Position
local deltaPos = currentPos - lastPos

self.Instance.PrimaryPart.AssemblyLinearVelocity = deltaPos / dt + self._assemblyVeloAlter

lastPos = currentPos
end)

if onCancel() then
con:Disconnect()
end
end).cancel)
end

function MovingPlatform:Stop()
self._trove:Clean()
end

return MovingPlatform
82 changes: 42 additions & 40 deletions src/Server/Components/WindMonsterObstacle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,48 @@ local Component = require(ReplicatedStorage.Packages.Component) :: any
local Promise = require(ReplicatedStorage.Packages.Promise) :: any
local Trove = require(ReplicatedStorage.Packages.Trove)

local WindMonsterWall = Component.new({
Tag = "WindMonsterWall",
local WindMonsterObstacle = Component.new({
Tag = "WindMonsterObstacle",
})

function WindMonsterWall:_onTouched(hit: BasePart, touch: BasePart)
function WindMonsterObstacle:_onTouched(hit: BasePart, touch: BasePart)
assert(hit.Parent)
local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
if not hum then
return
end
local char = hum.Parent
assert(char)

local player = Players:GetPlayerFromCharacter(char)
assert(player)

local hrp = char:FindFirstChild("HumanoidRootPart")
assert(hrp and hrp:IsA("BasePart"))
if hrp:FindFirstChild("Blow") then
return
end

hum.Sit = true
local attachment = Instance.new("Attachment")
attachment.Parent = hrp

local linearVelo = Instance.new("LinearVelocity")
linearVelo.Name = "Blow"
linearVelo.MaxForce = 100000
linearVelo.Attachment0 = attachment
linearVelo.VectorVelocity = -touch.CFrame.LookVector * 100
linearVelo.Parent = hrp
task.wait(.1)
linearVelo.Enabled = false

task.wait(1)
linearVelo:Destroy()
attachment:Destroy()
local char = hum.Parent
assert(char)

local player = Players:GetPlayerFromCharacter(char)
assert(player)

local hrp = char:FindFirstChild("HumanoidRootPart")
assert(hrp and hrp:IsA("BasePart"))
if hrp:FindFirstChild("Blow") then
return
end

hum.Sit = true

local attachment = Instance.new("Attachment")
attachment.Parent = hrp

local linearVelo = Instance.new("LinearVelocity")
linearVelo.Name = "Blow"
linearVelo.MaxForce = 100000
linearVelo.Attachment0 = attachment
linearVelo.VectorVelocity = -touch.CFrame.LookVector * 100
linearVelo.Parent = hrp
task.wait(0.1)
linearVelo.Enabled = false

task.wait(1)
linearVelo:Destroy()
attachment:Destroy()
end

function WindMonsterWall:_scanForTouchingParts()
function WindMonsterObstacle:_scanForTouchingParts()
self._trove:Add(RunService.Heartbeat:Connect(function(dt: number)
if not self.Active then
return
Expand All @@ -66,16 +66,18 @@ function WindMonsterWall:_scanForTouchingParts()
end))
end

function WindMonsterWall:setEmitters(value: boolean)
function WindMonsterObstacle:setEmitters(value: boolean)
for _, monster: Instance in self._monsters do
local component = EmitterMonster:FromInstance(monster)
if not component then continue end
if not component then
continue
end

component:setEmitter(value)
end
end

function WindMonsterWall:Construct()
function WindMonsterObstacle:Construct()
self.OverlapParams = OverlapParams.new()
self.OverlapParams.FilterType = Enum.RaycastFilterType.Exclude
self.OverlapParams.FilterDescendantsInstances = { self.Instance }
Expand All @@ -93,12 +95,12 @@ function WindMonsterWall:Construct()
end
end

self._blowing = {}
self._blowing = {}

self:_scanForTouchingParts()
end

function WindMonsterWall:Start()
function WindMonsterObstacle:Start()
self._trove:Add(Promise.new(function(_, _, onCancel)
local running = true

Expand All @@ -117,8 +119,8 @@ function WindMonsterWall:Start()
end).cancel)
end

function WindMonsterWall:Stop()
function WindMonsterObstacle:Stop()
self._trove:Clean()
end

return WindMonsterWall
return WindMonsterObstacle
2 changes: 1 addition & 1 deletion src/Server/Modules/StatsModule.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function StatsModule.initialize(player: Player)

local level = Instance.new("IntValue")
level.Name = "Stage"
level.Value = 0
level.Value = 17
level.Parent = leaderstats

local wins = Instance.new("IntValue")
Expand Down

0 comments on commit dceab4d

Please sign in to comment.