-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbeat4sprite.lua
More file actions
71 lines (34 loc) · 1.92 KB
/
beat4sprite.lua
File metadata and controls
71 lines (34 loc) · 1.92 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
local astro = Astro.Table
local animationsDirectory = "/BGAnimations/" local path = "/Appearance/Themes/_fallback/Modules/beat4sprite/"
if tapLua.isLegacy() then path = "/Modules/beat4sprite/" end
beat4sprite = { Path = path, Modules = {} }
-- TODO: Color saturation config is not supported.
local function z(offset) local depth = 250 local i = 1 + offset return depth * i end
beat4sprite.Config = {
ScrollSync = false, PreviewRate = 0.5, MorphLayers = 64,
Depth = { Range = { - z(3), z( - 0.75 ) }, FOV = 160 }
}
-- To do tail calls in Lua 5.1 properly without it panicking I have to store the returned value in a variable first.
local function Load(name)
local loaded = loadfile( path .. "Scripts/" .. name .. ".lua" ) return loaded
end
local function animationPath( name, file )
file = file or "default.lua" return animationsDirectory .. name .. "/" .. file
end
local function randomAnimation()
local animations = FILEMAN:GetDirListing( animationsDirectory, true )
local path = astro.random(animations) path = animationPath(path) return loadfile(path)()
end
local function songBackgroundPath() return GAMESTATE:GetCurrentSong():GetBackgroundPath() end
local function Movie(data)
local loaded = loadfile( path .. "Movie/Actor.lua" )(data) return loaded
end
astro.merge( beat4sprite, {
Load = Load, animationPath = animationPath, randomAnimation = randomAnimation,
songBackgroundPath = songBackgroundPath, Movie = Movie
} )
local FILEMAN = tapLua.FILEMAN
local directories = { "Builder", "Modules" }
for i,v in ipairs(directories) do FILEMAN.LoadDirectory( path .. v .. '/' ) end
FILEMAN.LoadModule( "beat4sprite/Actor/Actor.lua" )
FILEMAN.LoadModule( "beat4sprite/BPMTracking.lua" )