summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--animated.lua6
-rw-r--r--assets/platforms/alpha-small-1.pngbin351 -> 0 bytes
-rw-r--r--assets/platforms/alpha-small.pngbin0 -> 821 bytes
-rw-r--r--ground.lua3
-rw-r--r--maps/alpha abyss.lua25
-rw-r--r--world.lua6
6 files changed, 31 insertions, 9 deletions
diff --git a/animated.lua b/animated.lua
index de16195..160ee44 100644
--- a/animated.lua
+++ b/animated.lua
@@ -27,8 +27,10 @@ end
-- Sets new animations list.
function Animated:setAnimationsList(t)
- self.animations = t
- self:setAnimation("default")
+ if t then
+ self.animations = t
+ self:setAnimation("default")
+ end
end
-- Sets current animation by table key.
diff --git a/assets/platforms/alpha-small-1.png b/assets/platforms/alpha-small-1.png
deleted file mode 100644
index b3f1a01..0000000
--- a/assets/platforms/alpha-small-1.png
+++ /dev/null
Binary files differ
diff --git a/assets/platforms/alpha-small.png b/assets/platforms/alpha-small.png
new file mode 100644
index 0000000..cce324f
--- /dev/null
+++ b/assets/platforms/alpha-small.png
Binary files differ
diff --git a/ground.lua b/ground.lua
index 50ded4f..1318c11 100644
--- a/ground.lua
+++ b/ground.lua
@@ -17,7 +17,7 @@ Ground.__index = Ground
setmetatable(Ground, Animated)
-- Constructor of `Ground`
-function Ground:new (game, world, x, y, shape, sprite)
+function Ground:new (game, world, x, y, shape, sprite, animations)
local o = {}
setmetatable(o, self)
o.body = love.physics.newBody(world, x, y)
@@ -40,6 +40,7 @@ function Ground:new (game, world, x, y, shape, sprite)
end
-- END HERE
o:setSprite(love.graphics.newImage(sprite))
+ o:setAnimationsList(animations)
o.world = game
return o
end
diff --git a/maps/alpha abyss.lua b/maps/alpha abyss.lua
index a3b6153..2df6adc 100644
--- a/maps/alpha abyss.lua
+++ b/maps/alpha abyss.lua
@@ -1,4 +1,20 @@
-- The abyss of the alpha.
+local animations_small = {
+ default = {
+ [1] = love.graphics.newQuad(0, 0, 60,20, 600,20),
+ [2] = love.graphics.newQuad(60, 0, 60,20, 600,20),
+ [3] = love.graphics.newQuad(120, 0, 60,20, 600,20),
+ [4] = love.graphics.newQuad(180, 0, 60,20, 600,20),
+ [5] = love.graphics.newQuad(240, 0, 60,20, 600,20),
+ [6] = love.graphics.newQuad(300, 0, 60,20, 600,20),
+ [7] = love.graphics.newQuad(360, 0, 60,20, 600,20),
+ [8] = love.graphics.newQuad(420, 0, 60,20, 600,20),
+ [9] = love.graphics.newQuad(480, 0, 60,20, 600,20),
+ [10] = love.graphics.newQuad(540, 0, 60,20, 600,20),
+ frames = 10,
+ repeated = true
+ }
+}
return {
-- GENERAL
name = "alpha abyss",
@@ -30,19 +46,22 @@ return {
x = -145,
y = -50,
shape = {0,0, 59,0, 59,19, 0,19},
- sprite = "assets/platforms/alpha-small-1.png"
+ sprite = "assets/platforms/alpha-small.png",
+ animations = animations_small
},
{
x = 85,
y = -50,
shape = {0,0, 59,0, 59,19, 0,19},
- sprite = "assets/platforms/alpha-small-1.png"
+ sprite = "assets/platforms/alpha-small.png",
+ animations = animations_small
},
{
x = -30,
y = -80,
shape = {0,0, 59,0, 59,19, 0,19},
- sprite = "assets/platforms/alpha-small-1.png"
+ sprite = "assets/platforms/alpha-small.png",
+ animations = animations_small
}
},
decorations = {}
diff --git a/world.lua b/world.lua
index e594c32..30359fd 100644
--- a/world.lua
+++ b/world.lua
@@ -93,7 +93,7 @@ function World:loadMap(name)
self.map = map()
-- Platforms
for _,platform in pairs(self.map.platforms) do
- self:createPlatform(platform.x, platform.y, platform.shape, platform.sprite)
+ self:createPlatform(platform.x, platform.y, platform.shape, platform.sprite, platform.animations)
end
-- Decorations
for _,decoration in pairs(self.map.decorations) do
@@ -125,8 +125,8 @@ function World:getSpawnPosition()
end
-- Add new platform to the world
-function World:createPlatform(x, y, polygon, sprite)
- table.insert(self.Platforms, Ground:new(self, self.world, x, y, polygon, sprite))
+function World:createPlatform(x, y, polygon, sprite, animations)
+ table.insert(self.Platforms, Ground:new(self, self.world, x, y, polygon, sprite, animations))
end
-- Add new naut to the world