Пример #1
0
    def __recreate_walls(self):
        walls = []
        for i in range(self.wall_number):
            w = Ray.random(self.screen_width,self.screen_height,200)
            walls.append(w)

        
        left = Ray(Vector2(0,0),Vector2(0,self.screen_height),4)
        right = Ray(Vector2(self.screen_width-1,0),Vector2(self.screen_width-1,self.screen_height),4)
        top = Ray(Vector2(0,0),Vector2(self.screen_width,0),4)
        bottom = Ray(Vector2(0,self.screen_height-1),Vector2(self.screen_width,self.screen_height-1),4)

        
        walls.append(left)
        walls.append(right)
        walls.append(top)
        walls.append(bottom)

        return walls
Пример #2
0
    def on_create(self):

        self.caster = Caster((self.screen_width/2,self.screen_height/2),self.ray_number)

        for i in range(self.wall_number):
            w = Ray.random(self.screen_width,self.screen_height,200)
            self.walls.append(w)

        #boundaries
        left = Ray(Vector2(0,0),Vector2(0,self.screen_height),4)
        right = Ray(Vector2(self.screen_width-1,0),Vector2(self.screen_width-1,self.screen_height),4)
        top = Ray(Vector2(0,0),Vector2(self.screen_width,0),4)
        bottom = Ray(Vector2(0,self.screen_height-1),Vector2(self.screen_width,self.screen_height-1),4)

        
        self.walls.append(left)
        self.walls.append(right)
        self.walls.append(top)
        self.walls.append(bottom)