97 lines
3.7 KiB
Lua
97 lines
3.7 KiB
Lua
-- gen_player.lua — public/assets/sprites/player.png
|
|
-- 64x96; frame 16x24; cols 0-3 = walk frames (col 0 also idle); rows 0=down 1=up 2=left 3=right
|
|
-- Gender-neutral chibi, cream / honey-orange palette, gentle "healing" look.
|
|
local ROOT = "/Users/leidianyayi/Documents/GitHub/ModelTest20260714/Kimi-K3/"
|
|
local H = dofile(ROOT .. "tools/aseprite/helpers.lua")
|
|
|
|
local spr, img = H.new(64, 96)
|
|
|
|
-- step: -1 left step, 0 stand, +1 right step
|
|
local function stepOf(f)
|
|
if f == 1 then return -1 elseif f == 3 then return 1 else return 0 end
|
|
end
|
|
|
|
-- legs shared by down/up (front/back view alternates a lifted foot)
|
|
local function legsFB(t, step)
|
|
if step == 0 then
|
|
t.rectn(5, 17, 2, 5, "cream_d"); t.rectn(9, 17, 2, 5, "cream_d")
|
|
t.rectn(4, 22, 3, 2, "brown"); t.rectn(9, 22, 3, 2, "brown")
|
|
elseif step == -1 then
|
|
t.rectn(5, 17, 2, 5, "cream_d"); t.rectn(4, 22, 3, 2, "brown") -- left planted
|
|
t.rectn(9, 17, 2, 4, "cream_d"); t.rectn(9, 21, 3, 2, "brown") -- right lifted
|
|
else
|
|
t.rectn(5, 17, 2, 4, "cream_d"); t.rectn(4, 21, 3, 2, "brown") -- left lifted
|
|
t.rectn(9, 17, 2, 5, "cream_d"); t.rectn(9, 22, 3, 2, "brown") -- right planted
|
|
end
|
|
end
|
|
|
|
local function drawDown(t, f)
|
|
local s = stepOf(f)
|
|
t.rectn(4, 2, 8, 3, "hair")
|
|
t.rectn(3, 3, 2, 6, "hair"); t.rectn(11, 3, 2, 6, "hair")
|
|
t.rectn(4, 4, 8, 6, "skin")
|
|
t.rectn(4, 2, 8, 1, "hair_l")
|
|
t.pn(5, 7, "ink"); t.pn(10, 7, "ink")
|
|
t.pn(6, 9, "skin_d"); t.pn(9, 9, "skin_d")
|
|
t.rectn(4, 11, 8, 6, "honey"); t.rectn(4, 11, 8, 1, "honey_l")
|
|
-- arms swing opposite to step
|
|
if s == 1 then t.rectn(3, 11, 2, 5, "honey"); t.rectn(3, 16, 2, 2, "skin")
|
|
else t.rectn(2, 11, 2, 5, "honey"); t.rectn(2, 16, 2, 2, "skin") end
|
|
if s == -1 then t.rectn(11, 11, 2, 5, "honey"); t.rectn(11, 16, 2, 2, "skin")
|
|
else t.rectn(12, 11, 2, 5, "honey"); t.rectn(12, 16, 2, 2, "skin") end
|
|
legsFB(t, s)
|
|
end
|
|
|
|
local function drawUp(t, f)
|
|
local s = stepOf(f)
|
|
t.rectn(3, 2, 10, 7, "hair")
|
|
t.rectn(4, 2, 8, 2, "hair_l")
|
|
t.rectn(3, 8, 10, 1, "hair_d")
|
|
t.rectn(6, 9, 4, 2, "skin_d")
|
|
t.rectn(4, 11, 8, 6, "honey"); t.rectn(4, 16, 8, 1, "honey_d")
|
|
t.rectn(2, 11, 2, 5, "honey"); t.rectn(12, 11, 2, 5, "honey")
|
|
t.rectn(2, 16, 2, 2, "skin"); t.rectn(12, 16, 2, 2, "skin")
|
|
legsFB(t, s)
|
|
end
|
|
|
|
local function drawLeft(t, f)
|
|
local s = stepOf(f)
|
|
-- hair (back of head toward the right / behind)
|
|
t.rectn(5, 2, 7, 3, "hair"); t.rectn(5, 2, 7, 1, "hair_l")
|
|
t.rectn(9, 3, 3, 6, "hair")
|
|
-- face (pointing left)
|
|
t.rectn(4, 4, 7, 6, "skin")
|
|
t.pn(5, 7, "ink")
|
|
t.pn(4, 8, "skin_d")
|
|
-- torso
|
|
t.rectn(4, 11, 8, 6, "honey"); t.rectn(4, 11, 8, 1, "honey_l")
|
|
-- front arm swings with step
|
|
if s == -1 then t.rectn(2, 11, 2, 5, "honey"); t.rectn(2, 16, 2, 2, "skin")
|
|
elseif s == 1 then t.rectn(5, 11, 2, 5, "honey"); t.rectn(5, 16, 2, 2, "skin")
|
|
else t.rectn(3, 11, 2, 5, "honey"); t.rectn(3, 16, 2, 2, "skin") end
|
|
-- profile legs scissor horizontally
|
|
if s == 0 then
|
|
t.rectn(5, 17, 2, 5, "cream_d"); t.rectn(8, 17, 2, 5, "cream_d")
|
|
t.rectn(4, 22, 3, 2, "brown"); t.rectn(7, 22, 3, 2, "brown")
|
|
elseif s == -1 then
|
|
t.rectn(4, 17, 2, 5, "cream_d"); t.rectn(3, 22, 3, 2, "brown") -- front leg forward
|
|
t.rectn(9, 17, 2, 4, "cream_d"); t.rectn(8, 21, 3, 2, "brown") -- back leg lifted
|
|
else
|
|
t.rectn(6, 17, 2, 4, "cream_d"); t.rectn(5, 21, 3, 2, "brown") -- back leg lifted
|
|
t.rectn(9, 17, 2, 5, "cream_d"); t.rectn(8, 22, 3, 2, "brown") -- front leg forward
|
|
end
|
|
end
|
|
|
|
for row = 0, 3 do
|
|
for col = 0, 3 do
|
|
local t = H.at(img, col * 16, row * 24)
|
|
if row == 0 then drawDown(t, col)
|
|
elseif row == 1 then drawUp(t, col)
|
|
elseif row == 2 then drawLeft(t, col)
|
|
else drawLeft(H.mirrorX(t, 16), col) end
|
|
end
|
|
end
|
|
|
|
spr:saveAs(ROOT .. "public/assets/sprites/player.png")
|
|
print("player.png done")
|