Python 3/PyGame/maze_3D/Maze_pkg/maze_class.py
def display(self):
        """ Draw the objects on the screen. """
        self.screen.fill(self.background)
        for position, node in self.nodes.items():
            # i get the square for the node
            pygame.draw.rect(self.screen, node.floor_color, (int(node.position[0])*self.node_width, int(node.position[1])*self.node_height, self.node_width, self.node_height), 0) # this is the floor
            # now lets draw the walls
            pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width, int(node.position[1])*self.node_height, self.node_width*0.1, self.node_height*0.1), 0) # top left corner
            pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width+self.node_width*0.9, int(node.position[1])*self.node_height, self.node_width*0.1, self.node_height*0.1), 0) # top right corner
            pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width+self.node_width*0.9, int(node.position[1])*self.node_height+self.node_height*0.9, self.node_width*0.1, self.node_height*0.1), 0) # bottom right corner
            pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width, int(node.position[1])*self.node_height+self.node_height*0.9, self.node_width*0.1, self.node_height*0.1), 0) # bottom left corner
            # taking wall width equal to 10% of the node size
            if not node.up: # top wall
                pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width+self.node_width*0.09, int(node.position[1])*self.node_height, self.node_width*0.82, self.node_height*0.1), 0)
            if not node.right: # right wall
                pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width+self.node_width*0.9, int(node.position[1])*self.node_height+self.node_height*0.09, self.node_width*0.1, self.node_height*0.82), 0)
            if not node.down: # bottom wall
                pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width+self.node_width*0.09, int(node.position[1])*self.node_height+self.node_height*0.9, self.node_width*0.82, self.node_height*0.1), 0)
            if not node.left: # left wall
                pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width, int(node.position[1])*self.node_height+self.node_height*0.09, self.node_width*0.1, self.node_height*0.82), 0)

        pygame.draw.rect(self.screen, self.runner.color, (self.runner.position[0]*self.node_width+(self.node_width/2-self.runner.width/2), self.runner.position[1]*self.node_height+(self.node_height/2-self.runner.height/2), self.runner.width, self.runner.height), 0)
 Draw the objects on the screen. 
Draw the objects on the screen.
Draw the objects on the screen .
def display(self):
        self.screen.fill(self.background)
        for position, node in self.nodes.items():
            pygame.draw.rect(self.screen, node.floor_color, (int(node.position[0])*self.node_width, int(node.position[1])*self.node_height, self.node_width, self.node_height), 0) 
            pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width, int(node.position[1])*self.node_height, self.node_width*0.1, self.node_height*0.1), 0) 
            pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width+self.node_width*0.9, int(node.position[1])*self.node_height, self.node_width*0.1, self.node_height*0.1), 0) 
            pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width+self.node_width*0.9, int(node.position[1])*self.node_height+self.node_height*0.9, self.node_width*0.1, self.node_height*0.1), 0) 
            pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width, int(node.position[1])*self.node_height+self.node_height*0.9, self.node_width*0.1, self.node_height*0.1), 0) 
            if not node.up: 
                pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width+self.node_width*0.09, int(node.position[1])*self.node_height, self.node_width*0.82, self.node_height*0.1), 0)
            if not node.right: 
                pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width+self.node_width*0.9, int(node.position[1])*self.node_height+self.node_height*0.09, self.node_width*0.1, self.node_height*0.82), 0)
            if not node.down: 
                pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width+self.node_width*0.09, int(node.position[1])*self.node_height+self.node_height*0.9, self.node_width*0.82, self.node_height*0.1), 0)
            if not node.left: 
                pygame.draw.rect(self.screen, node.wall_color, (int(node.position[0])*self.node_width, int(node.position[1])*self.node_height+self.node_height*0.09, self.node_width*0.1, self.node_height*0.82), 0)
        pygame.draw.rect(self.screen, self.runner.color, (self.runner.position[0]*self.node_width+(self.node_width/2-self.runner.width/2), self.runner.position[1]*self.node_height+(self.node_height/2-self.runner.height/2), self.runner.width, self.runner.height), 0)
def display ( self ) : self . screen . fill ( self . background ) for position , node in self . nodes . items ( ) : pygame . draw . rect ( self . screen , node . floor_color , ( int ( node . position [ 0 ] ) * self . node_width , int ( node . position [ 1 ] ) * self . node_height , self . node_width , self . node_height ) , 0 ) pygame . draw . rect ( self . screen , node . wall_color , ( int ( node . position [ 0 ] ) * self . node_width , int ( node . position [ 1 ] ) * self . node_height , self . node_width * 0.1 , self . node_height * 0.1 ) , 0 ) pygame . draw . rect ( self . screen , node . wall_color , ( int ( node . position [ 0 ] ) * self . node_width + self . node_width * 0.9 , int ( node . position [ 1 ] ) * self . node_height , self . node_width * 0.1 , self . node_height * 0.1 ) , 0 ) pygame . draw . rect ( self . screen , node . wall_color , ( int ( node . position [ 0 ] ) * self . node_width + self . node_width * 0.9 , int ( node . position [ 1 ] ) * self . node_height + self . node_height * 0.9 , self . node_width * 0.1 , self . node_height * 0.1 ) , 0 ) pygame . draw . rect ( self . screen , node . wall_color , ( int ( node . position [ 0 ] ) * self . node_width , int ( node . position [ 1 ] ) * self . node_height + self . node_height * 0.9 , self . node_width * 0.1 , self . node_height * 0.1 ) , 0 ) if not node . up : pygame . draw . rect ( self . screen , node . wall_color , ( int ( node . position [ 0 ] ) * self . node_width + self . node_width * 0.09 , int ( node . position [ 1 ] ) * self . node_height , self . node_width * 0.82 , self . node_height * 0.1 ) , 0 ) if not node . right : pygame . draw . rect ( self . screen , node . wall_color , ( int ( node . position [ 0 ] ) * self . node_width + self . node_width * 0.9 , int ( node . position [ 1 ] ) * self . node_height + self . node_height * 0.09 , self . node_width * 0.1 , self . node_height * 0.82 ) , 0 ) if not node . down : pygame . draw . rect ( self . screen , node . wall_color , ( int ( node . position [ 0 ] ) * self . node_width + self . node_width * 0.09 , int ( node . position [ 1 ] ) * self . node_height + self . node_height * 0.9 , self . node_width * 0.82 , self . node_height * 0.1 ) , 0 ) if not node . left : pygame . draw . rect ( self . screen , node . wall_color , ( int ( node . position [ 0 ] ) * self . node_width , int ( node . position [ 1 ] ) * self . node_height + self . node_height * 0.09 , self . node_width * 0.1 , self . node_height * 0.82 ) , 0 ) pygame . draw . rect ( self . screen , self . runner . color , ( self . runner . position [ 0 ] * self . node_width + ( self . node_width / 2 - self . runner . width / 2 ) , self . runner . position [ 1 ] * self . node_height + ( self . node_height / 2 - self . runner . height / 2 ) , self . runner . width , self . runner . height ) , 0 )
Draw the objects on the screen.
Draw the objects on the screen .
""" Draw the objects on the screen. """ # i get the square for the node # this is the floor # now lets draw the walls # top left corner # top right corner # bottom right corner # bottom left corner # taking wall width equal to 10% of the node size # top wall # right wall # bottom wall # left wall
self