Removes debug, adds more animated, separates code into files

This commit is contained in:
AliasAlreadyTaken 2024-04-01 14:03:27 +02:00
parent 08c50832a0
commit 6bb446c510
7 changed files with 123 additions and 63 deletions

View File

@ -1,63 +1,6 @@
local directions = {"blink", "down", "left", "right", "mid", "up"}
-- single
for _, direction in pairs(directions) do
local name = "single_" .. direction
core.log("action", name)
yl_googly_eyes.register_eye(name)
end
-- pair square
for _, direction in pairs(directions) do
local name = "pair_" .. direction .. "_square"
core.log("action", name)
yl_googly_eyes.register_eye(name)
end
-- pair round
local directions_roundpair = {"blink", "cross", "mid"}
for _, direction in pairs(directions_roundpair) do
local name = "pair_" .. direction .. "_round"
core.log("action", name)
yl_googly_eyes.register_eye(name)
end
-- animated example
local texture =
"[combine:16x256:" .. "0,0=yl_googly_eyes_pair_down_square.png:" .. -- 1
"0,16=yl_googly_eyes_pair_left_square.png:" .. -- 2
"0,32=yl_googly_eyes_pair_down_square.png:" .. -- 3
"0,48=yl_googly_eyes_pair_down_square.png:" .. -- 4
"0,64=yl_googly_eyes_pair_left_square.png:" .. -- 5
"0,80=yl_googly_eyes_pair_right_square.png:" .. -- 6
"0,96=yl_googly_eyes_pair_mid_square.png:" .. -- 7
"0,112=yl_googly_eyes_pair_down_square.png:" .. -- 8
"0,128=yl_googly_eyes_pair_down_square.png:" .. -- 9
"0,144=yl_googly_eyes_pair_down_square.png:" .. -- 10
"0,160=yl_googly_eyes_pair_down_square.png:" .. -- 11
"0,176=yl_googly_eyes_pair_blink_square.png:" .. -- 12
"0,192=yl_googly_eyes_pair_down_square.png:" .. -- 13
"0,208=yl_googly_eyes_pair_down_square.png:" .. -- 14
"0,224=yl_googly_eyes_pair_down_square.png:" .. -- 15
"0,240=yl_googly_eyes_pair_up_square.png" -- 16
local time0 = "yl_googly_eyes_blank.png"
local tile1 = {
image = texture,
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 48
}
}
local tiles = {tile0, tile0, tile0, tile0, tile1, tile0}
yl_googly_eyes.register_eye_with_tiles("everywhere", tiles)
dofile(yl_googly_eyes.modpath .. "def_pair_round.lua")
dofile(yl_googly_eyes.modpath .. "def_pair_round_animated.lua")
dofile(yl_googly_eyes.modpath .. "def_pair_square.lua")
dofile(yl_googly_eyes.modpath .. "def_pair_square_animated.lua")
dofile(yl_googly_eyes.modpath .. "def_single.lua")
dofile(yl_googly_eyes.modpath .. "def_single_animated.lua")

6
def_pair_round.lua Normal file
View File

@ -0,0 +1,6 @@
local directions = {"blink", "cross", "mid"}
for _, direction in pairs(directions) do
local name = "pair_" .. direction .. "_round"
yl_googly_eyes.register_eye(name)
end

View File

@ -0,0 +1,33 @@
local texture =
"[combine:16x256:" .. "0,0=yl_googly_eyes_pair_mid_round.png:" .. -- 1
"0,16=yl_googly_eyes_pair_mid_round.png:" .. -- 2
"0,32=yl_googly_eyes_pair_mid_round.png:" .. -- 3
"0,48=yl_googly_eyes_pair_mid_round.png:" .. -- 4
"0,64=yl_googly_eyes_pair_blink_round.png:" .. -- 5
"0,80=yl_googly_eyes_pair_mid_round.png:" .. -- 6
"0,96=yl_googly_eyes_pair_mid_round.png:" .. -- 7
"0,112=yl_googly_eyes_pair_mid_round.png:" .. -- 8
"0,128=yl_googly_eyes_pair_cross_round.png:" .. -- 9
"0,144=yl_googly_eyes_pair_mid_round.png:" .. -- 10
"0,160=yl_googly_eyes_pair_cross_round.png:" .. -- 11
"0,176=yl_googly_eyes_pair_mid_round.png:" .. -- 12
"0,192=yl_googly_eyes_pair_mid_round.png:" .. -- 13
"0,208=yl_googly_eyes_pair_mid_round.png:" .. -- 14
"0,224=yl_googly_eyes_pair_blink_round.png:" .. -- 15
"0,240=yl_googly_eyes_pair_cross_round.png" -- 16
local time0 = "yl_googly_eyes_blank.png"
local tile1 = {
image = texture,
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 48
}
}
local tiles = {tile0, tile0, tile0, tile0, tile1, tile0}
yl_googly_eyes.register_eye_with_tiles("animated_round", tiles)

6
def_pair_square.lua Normal file
View File

@ -0,0 +1,6 @@
local directions = {"blink", "down", "left", "right", "mid", "up"}
for _, direction in pairs(directions) do
local name = "pair_" .. direction .. "_square"
yl_googly_eyes.register_eye(name)
end

View File

@ -0,0 +1,33 @@
local texture =
"[combine:16x256:" .. "0,0=yl_googly_eyes_pair_down_square.png:" .. -- 1
"0,16=yl_googly_eyes_pair_left_square.png:" .. -- 2
"0,32=yl_googly_eyes_pair_down_square.png:" .. -- 3
"0,48=yl_googly_eyes_pair_down_square.png:" .. -- 4
"0,64=yl_googly_eyes_pair_left_square.png:" .. -- 5
"0,80=yl_googly_eyes_pair_right_square.png:" .. -- 6
"0,96=yl_googly_eyes_pair_mid_square.png:" .. -- 7
"0,112=yl_googly_eyes_pair_down_square.png:" .. -- 8
"0,128=yl_googly_eyes_pair_down_square.png:" .. -- 9
"0,144=yl_googly_eyes_pair_down_square.png:" .. -- 10
"0,160=yl_googly_eyes_pair_down_square.png:" .. -- 11
"0,176=yl_googly_eyes_pair_blink_square.png:" .. -- 12
"0,192=yl_googly_eyes_pair_down_square.png:" .. -- 13
"0,208=yl_googly_eyes_pair_down_square.png:" .. -- 14
"0,224=yl_googly_eyes_pair_down_square.png:" .. -- 15
"0,240=yl_googly_eyes_pair_up_square.png" -- 16
local time0 = "yl_googly_eyes_blank.png"
local tile1 = {
image = texture,
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 48
}
}
local tiles = {tile0, tile0, tile0, tile0, tile1, tile0}
yl_googly_eyes.register_eye_with_tiles("animated_square", tiles)

6
def_single.lua Normal file
View File

@ -0,0 +1,6 @@
local directions = {"blink", "down", "left", "right", "mid", "up"}
for _, direction in pairs(directions) do
local name = "single_" .. direction
yl_googly_eyes.register_eye(name)
end

33
def_single_animated.lua Normal file
View File

@ -0,0 +1,33 @@
local texture =
"[combine:16x256:" .. "0,0=yl_googly_eyes_single_mid.png:" .. -- 1
"0,16=yl_googly_eyes_single_mid.png:" .. -- 2
"0,32=yl_googly_eyes_single_mid.png:" .. -- 3
"0,48=yl_googly_eyes_single_mid.png:" .. -- 4
"0,64=yl_googly_eyes_single_blink.png:" .. -- 5
"0,80=yl_googly_eyes_single_mid.png:" .. -- 6
"0,96=yl_googly_eyes_single_mid.png:" .. -- 7
"0,112=yl_googly_eyes_single_mid.png:" .. -- 8
"0,128=yl_googly_eyes_single_left.png:" .. -- 9
"0,144=yl_googly_eyes_single_right.png:" .. -- 10
"0,160=yl_googly_eyes_single_mid.png:" .. -- 11
"0,176=yl_googly_eyes_single_mid.png:" .. -- 12
"0,192=yl_googly_eyes_single_mid.png:" .. -- 13
"0,208=yl_googly_eyes_single_mid.png:" .. -- 14
"0,224=yl_googly_eyes_single_up.png:" .. -- 15
"0,240=yl_googly_eyes_single_down.png" -- 16
local time0 = "yl_googly_eyes_blank.png"
local tile1 = {
image = texture,
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 48
}
}
local tiles = {tile0, tile0, tile0, tile0, tile1, tile0}
yl_googly_eyes.register_eye_with_tiles("animated_single", tiles)