summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--config/animations/default-clouds.lua18
-rw-r--r--config/maps/default.lua3
-rw-r--r--not/CloudGenerator.lua22
-rw-r--r--not/World.lua6
4 files changed, 27 insertions, 22 deletions
diff --git a/config/animations/default-clouds.lua b/config/animations/default-clouds.lua
new file mode 100644
index 0000000..bbf8a28
--- /dev/null
+++ b/config/animations/default-clouds.lua
@@ -0,0 +1,18 @@
+return
+{
+ default = {
+ [1] = love.graphics.newQuad( 1, 1, 158,47, 478,49),
+ frames = 1,
+ repeated = true
+ },
+ default2 = {
+ [1] = love.graphics.newQuad(160, 1, 158,47, 478,49),
+ frames = 1,
+ repeated = true
+ },
+ default3 = {
+ [1] = love.graphics.newQuad(319, 1, 158,47, 478,49),
+ frames = 1,
+ repeated = true
+ }
+}
diff --git a/config/maps/default.lua b/config/maps/default.lua
index ebfcbb8..216e703 100644
--- a/config/maps/default.lua
+++ b/config/maps/default.lua
@@ -14,7 +14,8 @@ return
},
create = {
{
- clouds = true
+ clouds = "assets/clouds.png",
+ animations = "default-clouds"
},
{
ratio = 0,
diff --git a/not/CloudGenerator.lua b/not/CloudGenerator.lua
index fb1b617..3285938 100644
--- a/not/CloudGenerator.lua
+++ b/not/CloudGenerator.lua
@@ -4,28 +4,10 @@ CloudGenerator = require "not.Object":extends()
require "not.Cloud"
-local animations = {
- default = {
- [1] = love.graphics.newQuad( 1, 1, 158,47, 478,49),
- frames = 1,
- repeated = true
- },
- default2 = {
- [1] = love.graphics.newQuad(160, 1, 158,47, 478,49),
- frames = 1,
- repeated = true
- },
- default3 = {
- [1] = love.graphics.newQuad(319, 1, 158,47, 478,49),
- frames = 1,
- repeated = true
- }
-}
-
-- TODO: Allow map config to modify cloud styles: maximum cloud count, animations and atlas.
-function CloudGenerator:new (world)
+function CloudGenerator:new (atlas, animations, world)
self.world = world
- self.atlas = "assets/clouds.png"
+ self.atlas = atlas
self.quads = animations
self.count = 18
self.interval = 6
diff --git a/not/World.lua b/not/World.lua
index 5d46b5b..e0febb7 100644
--- a/not/World.lua
+++ b/not/World.lua
@@ -97,7 +97,11 @@ function World:buildMap ()
bg.layer = self:addLayer(width, height, op.ratio)
end
if op.clouds then
- self:insertEntity(CloudGenerator(self)):run(6, true)
+ local animations = op.animations
+ if type(animations) == "string" then
+ animations = require("config.animations." .. animations)
+ end
+ self:insertEntity(CloudGenerator(op.clouds, animations, self)):run(6, true)
end
end
end