-
-
Notifications
You must be signed in to change notification settings - Fork 233
/
Copy patheffects.lua
147 lines (131 loc) · 4.49 KB
/
effects.lua
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
--[[
register(id, name, thingId, thingType, config)
config = {
speed, disableWalkAnimation, shader, drawOnUI, opacity
duration, loop, transform, hideOwner, size{width, height}
offset{x, y, onTop}, dirOffset[dir]{x, y, onTop},
light { color, intensity}, drawOrder(only for tiles),
bounce{minHeight, height, speed},
pulse{minHeight, height, speed},
fade{start, end, speed}
onAttach, onDetach
}
]]
--
AttachedEffectManager.register(1, 'Spoke Lighting', 12, ThingCategoryEffect, {
speed = 0.5,
onAttach = function(effect, owner)
print('onAttach: ', effect:getId(), owner:getName())
end,
onDetach = function(effect, oldOwner)
print('onDetach: ', effect:getId(), oldOwner:getName())
end
})
AttachedEffectManager.register(2, 'Bat Wings', 307, ThingCategoryCreature, {
speed = 5,
disableWalkAnimation = true,
shader = 'Outfit - Rainbow',
dirOffset = {
[North] = { 0, -10, true },
[East] = { 5, -5 },
[South] = { -5, 0 },
[West] = { -10, -5, true }
},
onAttach = function(effect, owner)
owner:setBounce(0, 10, 1000)
effect:setBounce(0, 10, 1000)
end,
onDetach = function(effect, oldOwner)
oldOwner:setBounce(0, 0)
end
})
AttachedEffectManager.register(3, 'Angel Light', 50, ThingCategoryEffect, {
opacity = 0.5,
drawOnUI = false
})
AttachedEffectManager.register(4, 'Four Angel Light', 0, 0, {
onAttach = function(effect, owner)
local angelLight = g_attachedEffects.getById(3)
local angelLight1 = angelLight:clone()
local angelLight2 = angelLight:clone()
local angelLight3 = angelLight:clone()
local angelLight4 = angelLight:clone()
angelLight1:setOffset(-50, 50, true)
angelLight2:setOffset(50, 50, true)
angelLight3:setOffset(50, -50, true)
angelLight4:setOffset(-50, -50, true)
effect:attachEffect(angelLight1)
effect:attachEffect(angelLight2)
effect:attachEffect(angelLight3)
effect:attachEffect(angelLight4)
end
})
AttachedEffectManager.register(5, 'Transform', 40, ThingCategoryCreature, {
transform = true,
duration = 5000,
onAttach = function(effect, owner)
local e = Effect.create()
e:setId(7)
owner:getTile():addThing(e)
end,
onDetach = function(effect, oldOwner)
local e = Effect.create()
e:setId(50)
oldOwner:getTile():addThing(e)
end
})
AttachedEffectManager.register(6, 'Lake Monster', 34, ThingCategoryEffect, {
hideOwner = true,
duration = 1500,
-- loop = 1,
onDetach = function(effect, oldOwner)
local e = Effect.create()
e:setId(54)
oldOwner:getTile():addThing(e)
end
})
AttachedEffectManager.register(7, 'Pentagram Aura', '/images/game/effects/pentagram', ThingExternalTexture, {
size = { 128, 128 },
offset = { 50, 45 }
})
AttachedEffectManager.register(8, 'Ki', '/images/game/effects/ki', ThingExternalTexture, {
size = { 140, 110 },
offset = { 60, 75, true },
pulse = { 0, 50, 3000 },
--fade = { 0, 100, 1000 },
})
AttachedEffectManager.register(9, 'Thunder', '/images/game/effects/thunder', ThingExternalTexture, {
loop = 1,
offset = { 215, 230 }
})
AttachedEffectManager.register(10, 'Dynamic Effect', 0, 0, {
duration = 500,
onAttach = function(effect, owner)
local spriteSize = g_gameConfig.getSpriteSize()
local length = 3
local missile = AttachedEffect.create(38, ThingCategoryMissile)
missile:setDuration(effect:getDuration())
missile:setDirection(5)
missile:setOffset(spriteSize * length, 0)
missile:setBounce(0, 15, 1000)
missile:move(Position.translated(owner:getPosition(), -length, 0), owner:getPosition())
effect:attachEffect(missile)
missile = AttachedEffect.create(38, ThingCategoryMissile)
missile:setDuration(effect:getDuration())
missile:setDirection(3)
missile:setOffset(-(spriteSize * length), 0)
missile:setBounce(0, 15, 1000)
missile:move(Position.translated(owner:getPosition(), length, 0), owner:getPosition())
effect:attachEffect(missile)
end,
onDetach = function(effect, oldOwner)
local e = Effect.create()
e:setId(50)
oldOwner:getTile():addThing(e)
end
})
AttachedEffectManager.register(11, 'Bat', 307, ThingCategoryCreature, {
speed = 0.5,
offset = { 0, 0 },
bounce = { 20, 20, 2000 }
})