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.
 
 
miniworldmaker_cookbook/snippets/2 Movement/206_move_on_tiled_board_wit...

40 lines
849 B

from miniworldmaker import *
class MyBoard(TiledBoard):
def on_setup(self):
self.tile_size = 60
self.player = Player(position=(1, 1))
self.add_background("images/soccer_green.jpg")
self.background.is_scaled = True
self.speed = 10
print(self.is_running)
class Player(Token):
def on_setup(self):
self.add_costume("images/char_blue.png")
self.costume.is_upscaled = True
self.costume.orientation = - 90
def act(self):
if self.sensing_on_board(1):
self.move()
def on_key_down_w(self):
self.direction = "up"
def on_key_down_s(self):
self.direction = "down"
def on_key_down_a(self):
self.direction = "left"
def on_key_down_d(self):
self.direction = "right"
board = MyBoard(6, 4)
board.run()