Ultima attività 3 hours ago

capitalex's Avatar capitalex ha revisionato questo gist 3 hours ago. Vai alla revisione

1 file changed, 27 insertions

simple-object.lua(file creato)

@@ -0,0 +1,27 @@
1 + return function(animation, x, y)
2 + local object = {
3 + x = x
4 + , y = y
5 + , frame = 0
6 + , animation = animation
7 + , grabbed = false
8 + }
9 + function object:draw()
10 + if mouseIsPressed and not taken and self:contains(mouseX, mouseY) and not self.grabbed then
11 + self.grabbed = true
12 + taken = true
13 + elseif not mouseIsPressed then
14 + self.grabbed = false
15 + taken = false
16 + print(animation, self.x, self.y)
17 + end
18 + self:animate()
19 + if self.grabbed then
20 + self.x = mouseX
21 + self.y = mouseY
22 + end
23 + end
24 + require "is.animated" (object)
25 + require "is.sized" (object)
26 + return object
27 + end
Più nuovi Più vecchi