Simple animation
This commit is contained in:
parent
4f74397b3d
commit
be28934a65
@ -3,6 +3,8 @@ local gen= {}
|
|||||||
function gen:new(game,x,y,color,grid)
|
function gen:new(game,x,y,color,grid)
|
||||||
|
|
||||||
local Circle = game.objects.base:new(game,x,y,grid.cellsize,grid.cellsize)
|
local Circle = game.objects.base:new(game,x,y,grid.cellsize,grid.cellsize)
|
||||||
|
Circle.drawx = Circle.rect.x
|
||||||
|
Circle.drawy = Circle.rect.y
|
||||||
Circle.cellsize = grid.cellsize
|
Circle.cellsize = grid.cellsize
|
||||||
Circle.grid = grid
|
Circle.grid = grid
|
||||||
Circle.color = color
|
Circle.color = color
|
||||||
@ -19,6 +21,8 @@ function gen:new(game,x,y,color,grid)
|
|||||||
self.selected = true
|
self.selected = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
self.drawx = self.drawx + (self.rect.x-self.drawx)/10
|
||||||
|
self.drawy = self.drawy + (self.rect.y-self.drawy)/10
|
||||||
end
|
end
|
||||||
|
|
||||||
function Circle:isMyTurn()
|
function Circle:isMyTurn()
|
||||||
@ -28,7 +32,7 @@ function gen:new(game,x,y,color,grid)
|
|||||||
function Circle:draw()
|
function Circle:draw()
|
||||||
local spriteindex = 1
|
local spriteindex = 1
|
||||||
if self.selected then spriteindex = 2 end
|
if self.selected then spriteindex = 2 end
|
||||||
lg.draw(self.sprites[spriteindex],self.rect[1]-self.game.camerax-self.spriteoffx,self.rect[2]-self.game.cameray-self.spriteoffy)
|
lg.draw(self.sprites[spriteindex],self.drawx-self.game.camerax-self.spriteoffx,self.drawy-self.game.cameray-self.spriteoffy)
|
||||||
if self.selected then
|
if self.selected then
|
||||||
local i
|
local i
|
||||||
for i=1,#self.moves do
|
for i=1,#self.moves do
|
||||||
|
Loading…
Reference in New Issue
Block a user