From 6bb446c510c29713f6a96188963955024d62404d Mon Sep 17 00:00:00 2001 From: AliasAlreadyTaken Date: Mon, 1 Apr 2024 14:03:27 +0200 Subject: [PATCH] Removes debug, adds more animated, separates code into files --- blockdefinitions.lua | 69 ++++-------------------------------- def_pair_round.lua | 6 ++++ def_pair_round_animated.lua | 33 +++++++++++++++++ def_pair_square.lua | 6 ++++ def_pair_square_animated.lua | 33 +++++++++++++++++ def_single.lua | 6 ++++ def_single_animated.lua | 33 +++++++++++++++++ 7 files changed, 123 insertions(+), 63 deletions(-) create mode 100644 def_pair_round.lua create mode 100644 def_pair_round_animated.lua create mode 100644 def_pair_square.lua create mode 100644 def_pair_square_animated.lua create mode 100644 def_single.lua create mode 100644 def_single_animated.lua diff --git a/blockdefinitions.lua b/blockdefinitions.lua index c7afbd7..37ec7c3 100644 --- a/blockdefinitions.lua +++ b/blockdefinitions.lua @@ -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") \ No newline at end of file diff --git a/def_pair_round.lua b/def_pair_round.lua new file mode 100644 index 0000000..89d02e8 --- /dev/null +++ b/def_pair_round.lua @@ -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 \ No newline at end of file diff --git a/def_pair_round_animated.lua b/def_pair_round_animated.lua new file mode 100644 index 0000000..da57c95 --- /dev/null +++ b/def_pair_round_animated.lua @@ -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) \ No newline at end of file diff --git a/def_pair_square.lua b/def_pair_square.lua new file mode 100644 index 0000000..19abe23 --- /dev/null +++ b/def_pair_square.lua @@ -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 \ No newline at end of file diff --git a/def_pair_square_animated.lua b/def_pair_square_animated.lua new file mode 100644 index 0000000..0912cdc --- /dev/null +++ b/def_pair_square_animated.lua @@ -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) \ No newline at end of file diff --git a/def_single.lua b/def_single.lua new file mode 100644 index 0000000..52d97ac --- /dev/null +++ b/def_single.lua @@ -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 \ No newline at end of file diff --git a/def_single_animated.lua b/def_single_animated.lua new file mode 100644 index 0000000..fd53d49 --- /dev/null +++ b/def_single_animated.lua @@ -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) \ No newline at end of file