示例#1
0
small_star = ControlImageCollection("../game_assets/star1.png", 36,
                                    36).download_image()

sound_btn = ControlImageCollection("../game_assets/music_icon.png", 75,
                                   75).download_image()
sound_btn_off = ControlImageCollection("../game_assets/no_music_icon.png", 75,
                                       75).download_image()

kill_trap_img = ControlImageCollection("../game_assets/traps_icon_3.png", 90,
                                       90).download_image()
stop_trap_img = ControlImageCollection("../game_assets/traps_icon_1.png", 90,
                                       90).download_image()
destroying_trap_img = ControlImageCollection("../game_assets/traps_icon_2.png",
                                             90, 90).download_image()

tower_icon_img = ImageCollection("../game_assets/towers/tower image/", 4, 1,
                                 64, 0, "tower_icon_")
tower_icon_img.download_tower()

attack_tower_names = ["archer_long", "archer_short"]
support_tower_names = ["range", "damage"]

# points = []


@Singleton
class Game:
    path = []

    def __init__(self, win, username):
        self.__width = 1250
        self.__height = 700
示例#2
0
from enemies import enemy
from game.image_collection import ImageCollection


imgs = ImageCollection("enemies/", 20, 0, 64, 2, "_enemies_1_run_0")
imgs.download_images()

attack_imgs = ImageCollection("enemies/", 20, 0, 64, 2, "_enemies_1_attack_0")
attack_imgs.download_images()

die_imgs = ImageCollection("enemies/", 20, 0, 64, 2, "_enemies_1_die_0")
die_imgs.download_images()


class Wizard(enemy.Enemy):
    def __init__(self, path, game_map):
        super().__init__(path, game_map)
        self.name = "wizard"
        self.money = 3
        self.max_health = 3
        self.damage = 1
        self.armor = 0
        self.magick_resist = 4
        self.health = self.max_health
        self.active_imgs = imgs.images[:]
        self.attack_imgs = attack_imgs.images[:]
        self.die_imgs = die_imgs.images[:]



import pygame
from towers.tower import Tower
import math
from menu.menu import Menu
from game.image_collection import ImageCollection, ControlImageCollection

menu_bg = ControlImageCollection("../game_assets/menu1.png", 150,
                                 75).download_image()
upgrade_btn = ControlImageCollection("../game_assets/upgrade.png", 50,
                                     50).download_image()

tower_imgs = ImageCollection("../game_assets/towers/archer tower/1/", 3, 1,
                             100, 0, "archer_tower_2_")
tower_imgs.download_tower()

archer_imgs = ImageCollection("../game_assets/towers/archer/1/", 6, 1, 44, 0,
                              "archer_animation_")
archer_imgs.download_tower()


class ArcherTowerLong(Tower):
    is_game_pause = True

    def __init__(self, x, y):
        super().__init__(x, y)
        self.tower_imgs = tower_imgs.images[:]
        self.archer_imgs = archer_imgs.images[:]
        self.archer_count = 0
        self.price = 500
        self.range = 150
        self.original_range = self.range