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.
 
 

41 lines
1.0 KiB

from miniworldmaker import *
class MyBoard(TiledBoard):
def on_setup(self):
robot1 = Robot(position=(0, 0))
robot1.add_costume("images/robo_green.png")
robot1.costume.orientation = - 90
robot1.direction = "right"
robot2 = Robot(position=(4, 0))
robot2.add_costume("images/robo_yellow.png")
robot2.costume.orientation = - 90
robot2.direction = "left"
self.add_background("images/water.png")
class Explosion(Token):
def on_setup(self):
self.add_costume("images/explosion.png")
@timer(frames=5)
def remove():
self.remove()
class Robot(Token):
def act(self):
self.move()
other = self.sensing_token(token_filter=Robot)
if other:
print("sensed")
explosion = Explosion(position=self.position)
print("exploded")
self.remove()
print("self.removed")
other.remove()
print("other.removed")
board = MyBoard(5, 1)
board.run()