-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransform.lua
More file actions
44 lines (35 loc) · 903 Bytes
/
Copy pathtransform.lua
File metadata and controls
44 lines (35 loc) · 903 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
pico-8 cartridge // http://www.pico-8.com
version 18
__lua__
-- Transform
function gettransform()
local transform = {}
local cmp_type = "transform"
transform.__index = transform
setmetatable(transform, {
__index = component, -- this is what makes the inheritance work
__call = function (klass, ...)
local self = setmetatable({}, klass)
self:_init(...)
return self
end,
})
function transform:_init(x, y)
component._init(self, cmp_type) -- call the base class constructor
self.x = x
self.y = y
end
function transform:get_x()
return self.x
end
function transform:get_y()
return self.y
end
function transform:set_x(newx)
self.x = newx
end
function transform:set_y(newy)
self.y = newy
end
return transform
end