-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirstBlueFairiesLerp.lua
More file actions
93 lines (73 loc) · 2.47 KB
/
Copy pathfirstBlueFairiesLerp.lua
File metadata and controls
93 lines (73 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
ReplicatedStorage = game:GetService('ReplicatedStorage')
TweenService = game:GetService('TweenService')
RunService = game:GetService('RunService')
yLimit = 231.5
fairyVectorsTable = require(ReplicatedStorage.paths.firstStage.blueFairy.downnegativesinedown["better quality"])
local tweenArray = {}
local initialPos = {}
local fairiesDone = {}
local tweenInfo = TweenInfo.new(.1,Enum.EasingStyle.Linear)
local totalFairies = 5
--[[
local function tweeningINNIT(part,vecter)
local tweenInfo = TweenInfo.new(1,Enum.EasingStyle.Linear)
local tween = TweenService:Create(part,tweenInfo, { Position = vecter })
tween:Play()
end]]--
ReplicatedStorage.Assets.enemyAssets.firstBlueFairies:Clone().Parent = workspace.enemies.miniEnemies.blueFairies
for k,v in pairs(workspace.enemies.miniEnemies.blueFairies.firstBlueFairies:GetChildren()) do
v:SetAttribute('id', k)
end
--[[
function main()
for i,v in pairs(workspace.miniEnemies.blueFairies.firstBlueFairies:GetChildren()) do
if tweenArray[i].PlaybackState == Enum.TweenStatus.Completed then
if v.Position.Y >=231.5 then
v.Position = v.Position - Vector3.new(0,1,0)
else
local step = v.GetAttribute('step')
tweenArray[i] = TweenService:Create(v,tweenInfo ,{Position = v.Position + fairyVectorsTable[step + 1]})
tweenArray[i]:Play()
v.SetAttribute('step',step + 1)
end
end
end
]]--
function main()
for _,v in pairs(workspace.enemies.miniEnemies.blueFairies.firstBlueFairies:GetChildren()) do
if v.Position.Y <= 165 then
local i = v:GetAttribute('id')
fairiesDone[i] = true
v:Destroy()
do continue end
end
if v.Position.Y >= 231.5 then
v.Position = v.Position + Vector3.new(0,-.25,0)
--print("a" .. i)
do continue end
end
local i = v:GetAttribute('id')
if tweenArray[i] ~= nil and tweenArray[i].PlaybackState ~= Enum.PlaybackState.Completed then
--print("b" .. i)
do continue end
end
if tweenArray[i] == nil then
initialPos[i] = v.Position
end
local step = v:GetAttribute('step')
tweenArray[i] = TweenService:Create(v,tweenInfo ,{Position = initialPos[i] + fairyVectorsTable[step + 1]})
tweenArray[i]:Play()
v:SetAttribute('step',step + 1)
--print( "c" .. i)
end
if #fairiesDone == totalFairies then
script:Destroy()
end
--[[
for _,v in pairs(workspace.miniEnemies.blueFairies.firstBlueFairies:GetChildren()) do
tweeningINNIT(v,v.Position + fairyVectorsTable[j])
end
]]--
--print(tweenArray)
end
RunService.Heartbeat:Connect(main)