diff --git a/src/assets/characters/romata.png b/src/assets/characters/romata.png
new file mode 100644
index 0000000..f7791f7
Binary files /dev/null and b/src/assets/characters/romata.png differ
diff --git a/src/assets/characters/romata.xcf b/src/assets/characters/romata.xcf
new file mode 100644
index 0000000..fd11af5
Binary files /dev/null and b/src/assets/characters/romata.xcf differ
diff --git a/src/engine/animator.lua b/src/engine/animator.lua
index 1a27e86..e7bad60 100644
--- a/src/engine/animator.lua
+++ b/src/engine/animator.lua
@@ -6,9 +6,9 @@ Animator = class()
function Animator:__init(fullWidth, fullHeight)
self.animationGrid = anim8.newGrid(object.width, object.height, fullWidth, fullHeight)
- self.walk_up = anim8.newAnimation(self.animationGrid('1-9', 9), 0.1)
- self.walk_left = anim8.newAnimation(self.animationGrid('1-9', 10), 0.1)
- self.walk_down = anim8.newAnimation(self.animationGrid('1-9', 11), 0.1)
- self.walk_right = anim8.newAnimation(self.animationGrid('1-9', 12), 0.1)
+ self.walk_up = anim8.newAnimation(self.animationGrid('1-9', 1), 0.1)
+ self.walk_left = anim8.newAnimation(self.animationGrid('1-9', 2), 0.1)
+ self.walk_down = anim8.newAnimation(self.animationGrid('1-9', 3), 0.1)
+ self.walk_right = anim8.newAnimation(self.animationGrid('1-9', 4), 0.1)
end
diff --git a/src/engine/controllers/gridwalker.lua b/src/engine/controllers/gridwalker.lua
index b533eb0..176f463 100644
--- a/src/engine/controllers/gridwalker.lua
+++ b/src/engine/controllers/gridwalker.lua
@@ -74,7 +74,17 @@ function Gridwalker:init()
collider:setPassive(self.testShape)
self.animator = Animator:new(self.objectinfo.image:getWidth(), self.objectinfo.image:getHeight())
- self.animation = self.animator.walk_up
+
+ if self.objectinfo.pose == 'up' then
+ self.animation = self.animator.walk_up
+ elseif self.objectinfo.pose == 'down' then
+ self.animation = self.animator.walk_down
+ elseif self.objectinfo.pose == 'right' then
+ self.animation = self.animator.walk_right
+ elseif self.objectinfo.pose == 'left' then
+ self.animation = self.animator.walk_left
+ end
+
self.animation:pauseAtStart()
end
diff --git a/src/levels/01.lua b/src/levels/01.lua
index 42cc88b..24ed6b8 100644
--- a/src/levels/01.lua
+++ b/src/levels/01.lua
@@ -210,6 +210,18 @@ return {
rotation = 0,
visible = true,
properties = {}
+ },
+ {
+ name = "romata",
+ type = "",
+ shape = "rectangle",
+ x = 320,
+ y = 160,
+ width = 32,
+ height = 64,
+ rotation = 0,
+ visible = true,
+ properties = {}
}
}
},
diff --git a/src/assets/map.tmx b/src/levels/01.tmx
similarity index 97%
rename from src/assets/map.tmx
rename to src/levels/01.tmx
index ea47cd5..38d3b6b 100644
--- a/src/assets/map.tmx
+++ b/src/levels/01.tmx
@@ -30,6 +30,7 @@
+
diff --git a/src/objects/matty.lua b/src/objects/matty.lua
index 14fe409..52d9208 100644
--- a/src/objects/matty.lua
+++ b/src/objects/matty.lua
@@ -2,7 +2,7 @@ local object = require "engine/object"
local gridwalker = require "engine/controllers/gridwalker"
return {
- spritesheet = "assets/characters/matty.png",
- pose = object.walking_down,
+ spritesheet = "assets/characters/romata.png",
+ pose = 'down',
controller = Gridwalker()
}
diff --git a/src/objects/player.lua b/src/objects/player.lua
index 8e74849..10d75e5 100644
--- a/src/objects/player.lua
+++ b/src/objects/player.lua
@@ -2,8 +2,8 @@ local object = require "engine/object"
local gridwalker = require "engine/controllers/gridwalker"
return {
- spritesheet = "assets/characters/player.png",
- pose = object.walking_up,
+ spritesheet = "assets/characters/romata.png",
+ pose = 'up',
controller = Gridwalker(),
relevantKeys = {
"w", "up",
diff --git a/src/objects/romata.lua b/src/objects/romata.lua
new file mode 100644
index 0000000..db379e6
--- /dev/null
+++ b/src/objects/romata.lua
@@ -0,0 +1,8 @@
+local object = require "engine/object"
+local gridwalker = require "engine/controllers/gridwalker"
+
+return {
+ spritesheet = "assets/characters/romata.png",
+ pose = 'left',
+ controller = Gridwalker()
+}