Tests examples for the miniworldmaker engine https://www.miniworldmaker.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

112 lines
2.7 KiB

from miniworldmaker import *
board = HexBoard(12, 12)
board.tile_size = 40
for x in range(board.columns):
for y in range(board.rows):
t = Token((x,y))
t.add_costume(f"images/grass_08.png")
t.static = True
token = Token((0,1)) # move right to (1,0)
token.size = 1
token.inner = True
#token.add_costume("images/castle_large.png")
token = Token((1,1)) # move right to (1,0)
token.size = 1
token.fill_color = (255,0,0,100)
token.inner = True
token = Token((0,3))
#token.add_costume("images/castle_large.png")
token.size = 0.1
token.fill_color=(0,0,0)
token.corner = "n"
print("# BORDERS")
c1 = board.get_corner_from_tile((2,0),"sw")
c2 = board.get_corner_from_tile((2,1),"n")
# (2,0).sw and (2.1).n are the same coordinates!
assert(c1.position == CubeCoord(3,1,-2))
assert(c1.direction == CubeCoord(1,1,0))
assert(c2.position == CubeCoord(3,1,-2))
assert(c2.direction == CubeCoord(1,1,0))
assert(c1 == c2)
# Edge
edge = HexEdge.from_tile((0,5), "nw")
token = edge.create_token()
token.size = (0.2, 0.4)
token.color = (10,10,10,100)
token.direction = edge.get_direction()
edge = HexEdge.from_tile((0,5), "w")
token = edge.create_token()
token.size = (0.2, 0.4)
token.color = (40,40,40,100)
token.direction = edge.get_direction()
edge = HexEdge.from_tile((0,5), "sw")
token = edge.create_token()
token.size = (0.2, 0.4)
token.color = (90,90,90,100)
token.direction = edge.get_direction()
edge = HexEdge.from_tile((0,5), "so")
token = edge.create_token()
token.size = (0.2, 0.4)
token.color = (140,140,140,100)
token.direction = edge.get_direction()
edge = HexEdge.from_tile((0,5), "o")
token = edge.create_token()
token.size = (0.2, 0.4)
token.color = (180,180,180,100)
token.direction = edge.get_direction()
edge = HexEdge.from_tile((0,5), "no")
token = edge.create_token()
token.size = (0.2, 0.4)
token.color = (220,220,220,100)
token.direction = edge.get_direction()
"""
# CORNERS
"""
token = HexCorner.from_tile((2,3), "no").create_token()
token.size = (0.2, 0.2)
token.fill_color = (40,40,40,100)
token = HexCorner.from_tile((2,3), "so").create_token()
token.size = (0.2, 0.2)
token.fill_color = (120,120,120,255)
token = HexCorner.from_tile((2,3), "s").create_token()
token.size = (0.2, 0.2)
token.fill_color = (140,140,140,255)
token = HexCorner.from_tile((2,3), "sw").create_token()
token.size = (0.2, 0.2)
token.fill_color = (170,170,170,255)
token = HexCorner.from_tile((2,3), "nw").create_token()
token.size = (0.2, 0.2)
token.fill_color = (200,200,200,255)
token = HexCorner.from_tile((2,3), "n").create_token()
token.fill_color = (255,255,255)
token.size = (0.2, 0.2)
# EVENTS
@board.register
def on_mouse_motion(self, mouse_pos):
#print(mouse_pos.to_pixel())
pass
board.run()