Example #1
0
 def __init__(self, movement, target, tower):
     self.target = target
     self.tower = tower
     self.image = load_image("bullet.png")
     self.active = True
     self.x = tower.get_rect().centerx
     self.y = tower.get_rect().centery
     self.damage = 3
     self.width = self.image.get_rect().width
     self.height = self.image.get_rect().height
     self.movement = movement
Example #2
0
File: Tower.py Project: giurix/P3
 def __init__(self, movement, target, tower,):
     self.target = target
     self.tower = tower
     self.image = load_image("bullet.png")
     self.active = True
     self.x = tower.get_rect().centerx
     self.y = tower.get_rect().centery
     self.damage = 15
     self.width = self.image.get_rect().width
     self.height = self.image.get_rect().height
     self.movement = movement
Example #3
0
 def __init__(self, game, waypoint):
     self.game = game
     self.walking_speed = 0.08
     self.max_hp = 40
     self.current_hp = 40
     self.next_waypoint = self.game.get_next_waypoint(waypoint)
     self.image = load_image("enemy.png")
     self.info_layer = pygame.Surface((self.image.get_rect().width, self.image.get_rect().height), pygame.SRCALPHA)
     self.x = waypoint[0] - (self.image.get_rect().width / 2)
     self.y = waypoint[1] - (self.image.get_rect().height / 2)
     self.active = True
     self.attacked_by = []
Example #4
0
File: Enemy.py Project: giurix/P3
 def __init__(self, game, waypoint):
     self.game = game
     self.walking_speed = 0.50
     self.max_hp = 40
     self.current_hp = 5
     self.next_waypoint = self.game.get_next_waypoint(waypoint)
     self.image = load_image("enemy.png")
     self.info_layer = pygame.Surface(
         (self.image.get_rect().width, self.image.get_rect().height),
         pygame.SRCALPHA)
     self.x = waypoint[0] - (self.image.get_rect().width / 2)
     self.y = waypoint[1] - (self.image.get_rect().height / 2)
     self.active = True
     self.attacked_by = []
Example #5
0
File: main.py Project: giurix/P3
    def __init__(self):
        self.money= 500
        self.irand= randint(3, 10)
        self.screenrect = get_screenrect()
        self.surface = pygame.Surface((1280, 720))
        self.background_image = load_image("bg.png")
        self.surface.blit(self.background_image, (0, 0))
        self.game_timer = 0
        self.wave_times2 = [[100]]
        self.wave_times = [
            [100, 1000, 1500, 2500, 3000, 6000],
            [100, 500, 1000],
            [100, 500, 1300, 2400]
        ]
        self.wave_time_index = 0
        self.money_index = 500
        self.current_wave = self.wave_times[self.wave_time_index]
        self.current_wave_completed = False
        self.current_wave_index = 0
        self.tower_pos = [
            [150, 50, "down"],
            [150, 120, "down"],

        ]
        self.slots = []
        self.towers = []
        self.waypoint_list = [
            [100, 0],
            [100, 620],
            [400, 620],
            [400, 100],
            [700, 100],
            [700, 620],
            [1000, 620],
            [1000, 100],
            [1280, 100]
        ]
        self.enemies = []
        self.spawned = 0
        self.killed = 0
        self.wave_text = text_surface("Wave: 1", font_size=24)
        self.money_text = text_surface("Danish Dollars: 500", font_size=24)
        self.health_index = 100
        self.health_text = text_surface("Health: 100", font_size=24)
        self.post_init()
        self.lost = text_surface("YOU LOST!", font_size=50)
Example #6
0
 def __init__(self):
     self.screenrect = get_screenrect()
     self.surface = pygame.Surface((480, 320))
     self.background_image = load_image("bg.png")
     self.surface.blit(self.background_image, (0, 0))
     self.game_timer = 0
     self.wave_times2= [[100]]
     self.wave_times = [
         [100, 1000, 1500, 2500, 3000, 6000],
         [100, 500, 1000],
         [100, 500, 1300, 2400]
     ]
     self.wave_time_index = 0
     self.current_wave = self.wave_times[self.wave_time_index]
     self.current_wave_completed = False
     self.current_wave_index = 0
     self.tower_pos = [
         [60, 32, "down"],
         [150, 32, "down"],
         [240, 32, "down"],
         [330, 32, "down"],
         [370, 124, "up"],
         [280, 124, "up"],
         [190, 124, "up"],
         [100, 124, "up"],
         [60, 218, "up"],
         [150, 218, "up"],
         [240, 218, "up"],
         [330, 218, "up"],
     ]
     self.slots = []
     self.towers = []
     self.waypoint_list = [
         [0, 100],
         [440, 100],
         [440, 194],
         [35, 194],
         [35, 286],
         [380, 286],
     ]
     self.enemies = []
     self.spawned = 0
     self.killed = 0
     self.wave_text = text_surface("Wave: 1", font_size=24)
     self.post_init()
Example #7
0
 def __init__(self, x, y, slot, game):
     self.game = game
     self.default_direction = None
     self.x = x
     self.y = y
     self.attack_range = 70
     self.damage = 10
     self.fire_rate = 1000
     self.attacking = False
     self.target = None
     self.angle = 0
     self.image = load_image("tower.png")
     self.rotated_image = self.image
     self.image_rect = self.image.get_rect()
     self.draw_range_circle = False
     self.last_image_update = 0
     self.last_image_update_max = 10
     self.attack_timer = 0
     self.bullets = []
     self.set_default_direction(slot)
Example #8
0
File: Tower.py Project: giurix/P3
 def __init__(self, x, y, slot, game):
     self.price = 50
     self.game = game
     self.default_direction = None
     self.x = x
     self.y = y
     self.attack_range = 200
     self.damage = 10
     self.fire_rate = 1000
     self.attacking = False
     self.target = None
     self.angle = 0
     self.image = load_image("tower.png")
     self.rotated_image = self.image
     self.image_rect = self.image.get_rect()
     self.draw_range_circle = True
     self.last_image_update = 0
     self.last_image_update_max = 10
     self.attack_timer = 0
     self.bullets = []
     self.set_default_direction(slot)
Example #9
0
 def __init__(self, image, width, height, padding):
     self.image_name = image
     self.image = load_image(self.image_name)
     self.width = width
     self.height = height
     self.padding = padding
Example #10
0
File: Tower.py Project: giurix/P3
 def __init__(self, x, y, facing):
     self.x = x
     self.y = y
     self.facing = facing
     self.surface = load_image("open_spot.png")
Example #11
0
 def load_images(self):
     for k, v in self.tile_info.items():
         i = load_image(v["image"])
         self.images[v["image"]] = i
Example #12
0
 def __init__(self):
     self.test_image = load_image("enemy.png")
     self.degrees = 0
     self.last_move = 0
 def __init__(self):
     self.test_image = load_image("enemy.png")
     self.degrees = 0
     self.last_move = 0
Example #14
0
 def __init__(self, x, y, facing):
     self.x = x
     self.y = y
     self.facing = facing
     self.surface = load_image("open_spot.png")