Added new images for pawn textures and added loop to make black and white version of pieces. Also fixed the board creation. Not sure if working correctly though
parent
2dae98c1b7
commit
5df3b47fca
12
init.lua
12
init.lua
|
@ -23,11 +23,11 @@ minetest.register_node(":chess:spawn",{
|
|||
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
after_place_node = function(pos)
|
||||
|
||||
local size = 20
|
||||
local size = 8
|
||||
local alternate = true
|
||||
|
||||
for i = size, 0, -1 do
|
||||
for ii = size, 0, -1 do
|
||||
for i = size, 1, -1 do
|
||||
for ii = size, 1, -1 do
|
||||
|
||||
local p = {x=pos.x+i+1, y=pos.y, z=pos.z+ii+1}
|
||||
|
||||
|
@ -40,7 +40,7 @@ minetest.register_node(":chess:spawn",{
|
|||
end
|
||||
end
|
||||
|
||||
if (math.floor(size/2) ~= size/2) then
|
||||
if (math.floor(size/2) == size/2) then
|
||||
if alternate then
|
||||
alternate = false
|
||||
else
|
||||
|
@ -65,7 +65,7 @@ minetest.register_craft({
|
|||
--Register the Board Blocks: white
|
||||
minetest.register_node(":chess:board_white",{
|
||||
description = "White Chess Board Piece",
|
||||
tile_images = {"chess_white.png"},
|
||||
tile_images = {"chess_board_white.png"},
|
||||
inventory_image = "chess_white.png",
|
||||
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
})
|
||||
|
@ -73,7 +73,7 @@ minetest.register_node(":chess:board_white",{
|
|||
--Register the Board Blocks: black
|
||||
minetest.register_node(":chess:board_black",{
|
||||
description = "Black Chess Board Piece",
|
||||
tile_images = {"chess_black.png"},
|
||||
tile_images = {"chess_board_black.png"},
|
||||
inventory_image = "chess_black.png",
|
||||
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
})
|
||||
|
|
75
pieces.lua
75
pieces.lua
|
@ -1,31 +1,48 @@
|
|||
--This file declares all the pieces for the game
|
||||
|
||||
--Pawns
|
||||
minetest.register_node(":chess:pawn",
|
||||
{
|
||||
description = 'pawn',
|
||||
groups = {snappy = 2},
|
||||
tiles = {"chess_black.png"},
|
||||
drawtype = "nodebox",
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
paramtype2 = "facedir",
|
||||
light_source = 8, --max light is 18
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.2, -0.5, -0.3, 0.2, -0.4, 0.3},
|
||||
{-0.3, -0.5, -0.2, 0.2, -0.4, 0.3},
|
||||
{-0.1, -0.4, -0.2, 0.1, -0.3, 0.2},
|
||||
{-0.2, -0.4, -0.1, 0.2, -0.3, 0.1},
|
||||
{-0.1, -0.3, -0.1, 0.1, 0.2, 0.1},
|
||||
{-0.2, -0.1, -0.1, 0.2, 0.1, 0.1},
|
||||
{-0.1, -0.1, -0.2, 0.1, 0.1, 0.2},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.2, 0.3},
|
||||
},
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}
|
||||
})
|
||||
local colors = {"black", "white",}
|
||||
|
||||
--make a loop which makes the black and white nodes and crafting recipes
|
||||
|
||||
for color = 1, 2 do
|
||||
--Pawn
|
||||
minetest.register_node(":chess:pawn_"..colors[color],
|
||||
{
|
||||
description = 'pawn',
|
||||
groups = {snappy = 2},
|
||||
tiles = {"chess_piece_"..colors[color]..".png"},
|
||||
drawtype = "nodebox",
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
paramtype2 = "facedir",
|
||||
light_source = 8, --max light is 18
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.2, -0.5, -0.3, 0.2, -0.4, 0.3},
|
||||
{-0.3, -0.5, -0.2, 0.2, -0.4, 0.3},
|
||||
{-0.1, -0.4, -0.2, 0.1, -0.3, 0.2},
|
||||
{-0.2, -0.4, -0.1, 0.2, -0.3, 0.1},
|
||||
{-0.1, -0.3, -0.1, 0.1, 0.2, 0.1},
|
||||
{-0.2, -0.1, -0.1, 0.2, 0.1, 0.1},
|
||||
{-0.1, -0.1, -0.2, 0.1, 0.1, 0.2},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.2, 0.3},
|
||||
},
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}
|
||||
})
|
||||
|
||||
--Rook
|
||||
|
||||
--Knight
|
||||
|
||||
--Bishop
|
||||
|
||||
--Queen
|
||||
|
||||
--King
|
||||
|
||||
end
|
||||
|
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in New Issue