Example #1
0
screen = pygame.display.set_mode(size)

if __name__ == '__main__':
    '''
    This is the program's starting point.
    We initialize the pygame module, create a screen and load
    resources (images etc.) in order to create the entities involved in
    the game.
    All entities are placed in a list, which we call world.
    At last, the game loop can be started using this list.
    '''

    tank1 = ai.AIBot(100, 500, pygame.image.load("tank1.gif"),
                     pygame.image.load("tank1_top.gif"), KEY_BINDINGS_1)
    tank2 = Tank(700, 100, pygame.image.load("tank2.gif"),
                 pygame.image.load("tank2_top.gif"), KEY_BINDINGS_2)

    #input_listener.append(tank1)
    input_listener.append(tank2)

    base1 = Base(100, 500, pygame.image.load("base.gif"), tank1)
    base2 = Base(700, 100, pygame.image.load("base.gif"), tank2)

    img = pygame.image.load('dirt.jpg')
    img = pygame.transform.scale(img, (WIDTH, HEIGHT))

    world = []
    world.append(base1)
    world.append(base2)
    world.append(tank1)
    world.append(tank2)
Example #2
0
    '''
    This is the program's starting point.
    We initialize the pygame module, create a screen and load
    resources (images etc.) in order to create the entities involved in
    the game.
    All entities are placed in a list, which we call world.
    At last, the game loop can be started using this list.
    '''
    
    pygame.init()

    size = WIDTH, HEIGHT
    screen = pygame.display.set_mode(size)

    tank1 = ai.AIBot(100, 500, pygame.image.load("tank1.gif"), pygame.image.load("tank1_top.gif"), KEY_BINDINGS_1)
    tank2 = Tank(700, 100, pygame.image.load("tank2.gif"), pygame.image.load("tank2_top.gif"), KEY_BINDINGS_2)
    
    #input_listener.append(tank1)
    input_listener.append(tank2)
    
    base1 = Base(100, 500, pygame.image.load("base.gif"), tank1)
    base2 = Base(700, 100, pygame.image.load("base.gif"), tank2)
    
    background_img = pygame.image.load('dirt.jpg')
    background_img = pygame.transform.scale(background_img, size)
    
    missile_img = pygame.image.load("missile.gif")
    Missile.missile_img = missile_img
    
    world = [base1, base2, tank1, tank2]
    tank1.set_world(world)
Example #3
0
 def __init__(self, x, y, img, top_img, key_binding=None):
     Tank.__init__(self, x, y, img, top_img, key_binding)
     self.pid_aim = PIDControl([10., 0., 1.])
Example #4
0
 def __init__(self, x, y, img, top_img, key_binding=None):
     Tank.__init__(self, x, y, img, top_img, key_binding)
     self.pid_aim = PIDControl([10., 0., 1.])
     self.pid_turn = PIDControl([20., 0., 0.])
     self.anti_gravity = AntiGravity()
Example #5
0
File: ai.py Project: stes/pyshooter
 def __init__(self, x, y, img, top_img, key_binding=None):
     Tank.__init__(self, x, y, img, top_img, key_binding)
     self.pid_aim = PIDControl([10., 0., 1.])
     self.pid_turn = PIDControl([20., 0., 0.])
     self.anti_gravity = AntiGravity()