naming convention for most stuff but not all

This commit is contained in:
lustlion
2022-03-04 23:28:30 +01:00
parent c978855711
commit cef2096577
29 changed files with 354 additions and 436 deletions

View File

@@ -1,6 +1,6 @@
Animation = {}
function Animation:New(anim_data)
function Animation:new(anim_data)
local o = {}
o.path = anim_data.path
@@ -14,17 +14,17 @@ function Animation:New(anim_data)
return o
end
function Animation:ChangeTo(anim_data)
function Animation:change(anim_data)
if anim_data.path == self.path
then
return self
else
return Animation:New(anim_data)
return Animation:new(anim_data)
end
end
-- to manually handle what frame
function Animation:DrawFrame(frame, x, y, rotate, sx, sy)
function Animation:drawFrame(frame, x, y, rotate, sx, sy)
if frame > #self.frames then
frame = #self.frames
end
@@ -43,7 +43,7 @@ function Animation:DrawFrame(frame, x, y, rotate, sx, sy)
end
-- to linearly animate
function Animation:Animate()
function Animation:animate()
if self.frames[self.frame] ~= 0 then
-- try to animate
self.subframe = self.subframe + current_dt
@@ -61,7 +61,7 @@ function Animation:Animate()
end
-- to draw the current frame
function Animation:Draw(x, y, rotate, sx, sy)
function Animation:draw(x, y, rotate, sx, sy)
local x = x or 0
local y = y or 0
local sx = sx or 1