generated from your-land/yl_template
Adds animated example
This commit is contained in:
parent
8a8cd88012
commit
6a2ce975b7
@ -4,25 +4,60 @@ local directions = {"blink", "down", "left", "right", "mid", "up"}
|
|||||||
|
|
||||||
for _, direction in pairs(directions) do
|
for _, direction in pairs(directions) do
|
||||||
local name = "single_" .. direction
|
local name = "single_" .. direction
|
||||||
core.log("action",name)
|
core.log("action", name)
|
||||||
yl_googly_eyes.register_eye(name)
|
yl_googly_eyes.register_eye(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- pair
|
-- pair square
|
||||||
|
|
||||||
for _, direction in pairs(directions) do
|
for _, direction in pairs(directions) do
|
||||||
local name = "pair_" .. direction .. "_square"
|
local name = "pair_" .. direction .. "_square"
|
||||||
core.log("action",name)
|
core.log("action", name)
|
||||||
yl_googly_eyes.register_eye(name)
|
yl_googly_eyes.register_eye(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- pair round
|
||||||
|
|
||||||
local directions_roundpair = {"blink", "cross", "mid"}
|
local directions_roundpair = {"blink", "cross", "mid"}
|
||||||
|
|
||||||
for _, direction in pairs(directions_roundpair) do
|
for _, direction in pairs(directions_roundpair) do
|
||||||
local name = "pair_" .. direction .. "_round"
|
local name = "pair_" .. direction .. "_round"
|
||||||
core.log("action",name)
|
core.log("action", name)
|
||||||
yl_googly_eyes.register_eye(name)
|
yl_googly_eyes.register_eye(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- animated
|
-- 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)
|
||||||
|
23
internal.lua
23
internal.lua
@ -56,3 +56,26 @@ end
|
|||||||
|
|
||||||
-- Each time the server loads, the animated ones have a different style of looking
|
-- Each time the server loads, the animated ones have a different style of looking
|
||||||
|
|
||||||
|
function yl_googly_eyes.register_eye_with_tiles(name, tiles)
|
||||||
|
minetest.register_node(":yl_googly_eyes:" .. name, {
|
||||||
|
description = "Googly Eyes!",
|
||||||
|
-- _doc_items_create_entry = false,
|
||||||
|
drawtype = "nodebox",
|
||||||
|
use_texture_alpha = "blend",
|
||||||
|
tiles = tiles,
|
||||||
|
is_ground_content = false,
|
||||||
|
--inventory_image = "yl_googly_eyes_" .. name .. ".png",
|
||||||
|
--wield_image = "yl_googly_eyes_" .. name .. ".png",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
walkable = false,
|
||||||
|
climbable = false,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.5, -0.4375, -0.5, 0.5, -0.4375, 0.5}
|
||||||
|
},
|
||||||
|
groups = {choppy = 3},
|
||||||
|
on_place = on_place
|
||||||
|
})
|
||||||
|
end
|
BIN
textures/yl_googly_eyes_blank.png
Normal file
BIN
textures/yl_googly_eyes_blank.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 564 B |
Loading…
Reference in New Issue
Block a user