Beispiel #1
0
    def on_enter(self):
        self.block = models.Block(1000, 1000)
        self.addChild(self.block.land_agent)
        self.player = models.Player(self.block, (500, 20))
        self.controls = player.Player(self.player)

        self.field = views.PlayField(self.block, self.player)
        self.main_frame = views.MainFrame(self.field)

        self.schedule_visit(
            owyl.repeatAlways(
                owyl.limit(
                    owyl.wrap(self.block.update),
                    limit_period = 0.1)
                )
            )
Beispiel #2
0
 def __init__(self, block):
     super(RiverGod, self).__init__()
     logger.debug('Initializing RiverGod...')
     self.block = block
     rows, columns = block.shape
     # Constrain the river source and end to the middle third
     rows_1_3 = rows // 3
     rows_2_3 = (rows * 2) // 3
     start_row = self.start_row = self.block.random.randint(rows_1_3, rows_2_3)
     end_row = self.end_row = self.block.random.randint(rows_1_3, rows_2_3)
     self.path = []
     self.schedule_visit(
         owyl.sequence(
             self.draw_river(
                 start = (start_row, 0),
                 end = (end_row, columns - 1),
                 scale = 50
                 ),
             owyl.wrap(self.stop)
             )
         )