noble animations

This commit is contained in:
2024-06-02 20:25:27 +03:00
parent f19610e458
commit 3ca6427583
15 changed files with 218 additions and 192 deletions

View File

@@ -1,21 +1,20 @@
Ground = {}
class("Ground").extends(Graphics.sprite)
local groundImage = Graphics.image.new("assets/sprites/groundFin")
class("Ground").extends(NobleSprite)
function Ground:init(x, y, player)
Ground.super.init(self, groundImage)
Ground.super.init(self, "assets/sprites/groundFin")
-- Collision properties
self:setZIndex(100)
self:setTag(3)
self:setCollideRect(0, 28, 800, 10)
self:setSize(800, 32)
-- Main properties
Ground.moveSpeed = 2
Ground.player = player
-- Move to initial position
self:add()
self:moveTo(x, y)
end
@@ -24,7 +23,6 @@ function Ground:setMoveSpeed(speed)
end
function Ground:update()
-- Stop ground
if Ground.moveSpeed == 0 then
return
@@ -43,5 +41,5 @@ function Ground:update()
end
-- Move ground
self:moveWithCollisions(self.x-Ground.moveSpeed, self.y)
end
self:moveWithCollisions(self.x - Ground.moveSpeed, self.y)
end