Примеры
1. Пример c ивентами
file.py
from alef_f import World,Robot,Move,Rotation
world = World(Vec3(10,10,10))
def on_spawn(source):
print("SPAWNED - ",source)
def on_update_position(source,new_position,old_position):
print("updated - ",source , " , old pos - ", old_position)
def on_update_entity(source,**kwargs):
print("ENTITY UPDATE - ",source," , updated_params - ",kwargs)
world.events.get_event("on_spawn").add_handler(on_spawn)
world.events.get_event("on_update_position").add_handler(on_update_position)
world.events.get_event("on_update_entity").add_handler(on_update_entity)
r1 = Robot(world)
r1.spawn()
for i in range(5):
r1.forward()
for i in range(5):
r1.back()
r1.turn(Rotation.Right)
r1.turn(Rotation.Right)
r1.turn(Rotation.Right)
for i in range(5):
r1.forward()
submit(world)