new spritesheet format
This commit is contained in:
parent
203f111b8a
commit
af45552f5f
BIN
src/assets/characters/romata.png
Normal file
BIN
src/assets/characters/romata.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
src/assets/characters/romata.xcf
Normal file
BIN
src/assets/characters/romata.xcf
Normal file
Binary file not shown.
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 = {}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -30,6 +30,7 @@
|
||||
<objectgroup name="objects">
|
||||
<object name="matty" x="416" y="96" width="32" height="64"/>
|
||||
<object name="player" x="320" y="480" width="32" height="64"/>
|
||||
<object name="romata" x="320" y="160" width="32" height="64"/>
|
||||
</objectgroup>
|
||||
<layer name="overlay" width="20" height="20">
|
||||
<data encoding="base64" compression="zlib">
|
@ -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()
|
||||
}
|
||||
|
@ -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",
|
||||
|
8
src/objects/romata.lua
Normal file
8
src/objects/romata.lua
Normal file
@ -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()
|
||||
}
|
Loading…
Reference in New Issue
Block a user