-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisual.lua
More file actions
26 lines (25 loc) · 810 Bytes
/
Visual.lua
File metadata and controls
26 lines (25 loc) · 810 Bytes
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
-- Everythiong visuals of the game
Visual = Class{}
function Visual:init(parameters)
self.apperance = parameters.apperance
self.structureworks = parameters.structureworks or {}
self.intermission = parameters.intermission or 0.05
self.timeframe = 0
self.latestFrame = 1
end
function Visual:getCurrentFrame()
return self.structureworks[self.latestFrame]
end
function Visual:restart()
self.timeframe = 0
self.latestFrame = 1
end
function Visual:update(dit)
self.timeframe = self.timeframe + dit
-- get the timeframe
while self.timeframe > self.intermission do
self.timeframe = self.timeframe - self.intermission
self.latestFrame = (self.latestFrame + 1) % #self.structureworks
if self.latestFrame == 0 then self.latestFrame = 1 end
end
end