def __init__(self, score):
     SceneBase.__init__(self)
     self.score = score
     self.slain = pygame.image.load("res/slain.png").convert_alpha()
     self.slain = pygame.transform.scale(self.slain, (round(WINDOW_WIDTH/1.7), round(WINDOW_HEIGHT/5)))
     self.go_bg = pygame.image.load("res/go_bg.png").convert()
     self.go_bg = pygame.transform.scale(self.go_bg, (round(WINDOW_WIDTH), round(WINDOW_HEIGHT)))
Exemple #2
0
    def __init__(self):
        SceneBase.__init__(self)
        playerimage = pygame.transform.scale(pygame.image.load("Images/player.png"), (30, 30))
        # creates the Player character in the location 20, 20
        self.player = Player.Player(30, 30, playerimage)

        blueParticle = pygame.image.load("Images/particle_blue.png")
        redParticle = pygame.image.load("Images/particle_red.png")
        # Defines the starting positions of the first two Particles for level 1 of the game
        self.particle1 = Particle.Particle(100, 100, False, None, redParticle, False)
        self.particle2 = Particle.Particle(100, 200, True, self.particle1, blueParticle, False)  # Particle 2 is entangled to Particle one

        # Defines the position for the first goal for level 1 of the game
        self.goal = Goal.Goal(400, 400)

        # NOTE: Negative numbers in wall declarations ruin collision detection
        self.leftWall = Wall.Wall(0, 0, 20, 600)
        self.rightWall = Wall.Wall(780, 0, 20, 600)
        self.topWall = Wall.Wall(0, 0, 800, 20)
        self.bottomWall = Wall.Wall(0, 580, 800, 20)
        self.door = Door.Door(760, 300, 20, 100)
        self.walls=[self.leftWall,self.rightWall,self.bottomWall,self.topWall]

        # Defines the objects that the Player character cannot pass through
        self.entities = [self.player,self.particle1, self.particle2, self.leftWall, self.rightWall, self.topWall, self.bottomWall]
        self.particles=[self.particle1,self.particle2]
        self.startTime=int(round(time.time()))
        pygame.mixer.music.load('A Strange Charm.wav')
        pygame.mixer.music.play(-1)
Exemple #3
0
 def __init__(self):
     SceneBase.__init__(self)
     self.rankedbg = pygame.image.load("res/ranked.png").convert()
     self.rankedbg = pygame.transform.scale(self.rankedbg, (WINDOW_WIDTH, WINDOW_HEIGHT))
     self.currentline = []
     self.indent = WINDOW_HEIGHT/3 - WINDOW_HEIGHT/4
     self.x = 0
Exemple #4
0
    def __init__(self, level, score):
        SceneBase.__init__(self)
        pygame.display.set_caption('Space Invaders² © ® ™ № 1')
        # Spielbreite festlegen
        self.width = width
        # Spielhöhe festlegen
        self.height = height
        # Spielzeit anlegen
        self.clock = pygame.time.Clock()
        # LocalPlayer mit Anfangsschiff hinzufügen
        self.player = LocalPlayer(self, width / 2, height - 20, Ship_Five,
                                  ProjectileWeapon)
        # Spielobjekte anlegen
        self.object = LocalObjects(self)
        # Gegner anlegen
        self.enemys = LocalEnemys(self)
        # Bedingung für die Schleife, Spielabbruch
        self.quitgame = False
        # Zeitstempel fürs Schießen
        self.vorherZeit = pygame.time.get_ticks()
        # Animationsgruppe
        self.animations_Explosions = pygame.sprite.Group()
        # Tastatur Invoker
        self.tastatur = Invoker()
        # Level
        self.level = level
        # Levelmanager
        self.levelmanager = Levelmanager(self)
        # Kollisionhandler
        self.collisionhandler = CollisionHandler(self)
        # Scorelabel
        self.scorelabel = TextBox((0, 0, 200, 32), "Score")
        # levellabel
        self.levellabel = TextBox((1000, 0, 200, 32), "Level")

        # Tastatur EInstellungen festlegen
        command_Down = PlayerDown(self)
        command_Up = PlayerUp(self)
        command_Right = PlayerRight(self)
        command_Left = PlayerLeft(self)
        command_Space = PlayerSpace(self)

        self.tastatur.setBefehl(pygame.K_DOWN, command_Down)
        self.tastatur.setBefehl(pygame.K_UP, command_Up)
        self.tastatur.setBefehl(pygame.K_RIGHT, command_Right)
        self.tastatur.setBefehl(pygame.K_LEFT, command_Left)
        self.tastatur.setBefehl(pygame.K_SPACE, command_Space)

        self.levelmanager.level = self.level
        self.player.setScore(score)
Exemple #5
0
    def __init__(self, player, clock):
        SceneBase.__init__(self)
        # creates the Player character in the location 20, 20
        self.player = player
        player.x = 30
        player.y = 30

        # Defines the starting positions of the first two Particles for level 3 of the game
        self.particle1 = Particle.Particle(90, 360, False, None, greenParticle,
                                           False)
        self.particle2 = Particle.Particle(
            90, 80, True, self.particle1, greenParticle,
            False)  # Particle 2 is entangled to Particle one

        # Defines the position for the first goal for level 3 of the game
        self.goal = Goal.Goal(720, 530)
        self.door = Door.Door(760, 100, 20, 100)
        # NOTE: Negative numbers in wall declarations ruin collision detection
        self.leftWall = Wall.Wall(0, 0, 20, 600)
        self.rightWall = Wall.Wall(780, 0, 20, 600)
        self.topWall = Wall.Wall(0, 0, 800, 20)
        self.bottomWall = Wall.Wall(0, 580, 800, 20)

        self.centerWallObstacle = Wall.Wall(20, 290, 780, 30)
        self.lowerWallObstacle = Wall.Wall(20, 390, 280, 20)
        self.middleWallObstacle = Wall.Wall(380, 300, 20, 180)
        self.rightWallObstacleOne = Wall.Wall(500, 450, 20, 130)
        self.rightWallObstacleTwo = Wall.Wall(580, 360, 200, 20)
        self.walls = [
            self.leftWall, self.rightWall, self.bottomWall, self.topWall,
            self.centerWallObstacle, self.lowerWallObstacle,
            self.middleWallObstacle, self.rightWallObstacleOne,
            self.rightWallObstacleTwo
        ]

        # Defines the objects that the Player character cannot pass through
        self.entities = [
            self.player, self.particle1, self.particle2, self.leftWall,
            self.rightWall, self.topWall, self.bottomWall,
            self.centerWallObstacle, self.lowerWallObstacle,
            self.middleWallObstacle, self.rightWallObstacleOne,
            self.rightWallObstacleTwo
        ]
        self.particles = [self.particle1, self.particle2]
        self.startTime = clock
Exemple #6
0
 def __init__(self):
     SceneBase.__init__(self)
     self.player = Circle(round(WINDOW_WIDTH / 2), round(WINDOW_HEIGHT / 2),
                          PLAYER_SIZE, GREEN, 0, 0, 0)
     self.score = 0
     self.moveDown = False
     self.moveUp = False
     self.moveRight = False
     self.moveLeft = False
     self.pause = False
     self.circles = generate_circles(CIRCLES_NUM, self.player)
     self.minions = [
         pygame.image.load('res/minion_1.png'),
         pygame.image.load('res/minion_2.png'),
         pygame.image.load('res/minion_3.png'),
         pygame.image.load('res/minion_4.png'),
         pygame.image.load('res/minion_5.png'),
         pygame.image.load('res/minion_6.png')
     ]
     self.background_image = pygame.image.load("res/bg.png").convert()
     self.background_image = pygame.transform.scale(
         self.background_image, (WINDOW_WIDTH, WINDOW_HEIGHT))
Exemple #7
0
    def __init__(self):
        SceneBase.__init__(self)
        UnitLoader.__init__()

        self.counter = 0
        self.Economy = False
        self.MoneyCounter = 0
        self.AttackRate = 0
        self.EAttackRate = 0
        self.Health = 1000
        if UpgradeData.defense:
            self.EHealth = 1500
        elif not UpgradeData.defense:
            self.EHealth = 1000

        print(self.Health)

        self.offset = 0
        self.movecamera = 0
        self.scrollfactor = 25

        self.UnitMovement = UnitMovement()

        if Options.hardcoremode:
            self.AI = BaseAI(6)
        else:
            self.AI = BaseAI(3)

        self.defendbutton = Button("Defend", (60, 635),
                                   self.Attack,
                                   size=(120, 30),
                                   font_size=20,
                                   bg=(109, 177, 255))
        self.holdbutton = Button("Hold", (185, 635),
                                 self.HoldPosition,
                                 size=(120, 30),
                                 font_size=20,
                                 bg=(109, 177, 255))
        self.attackbutton = Button("Attack", (310, 635),
                                   self.DefendPosition,
                                   size=(120, 30),
                                   font_size=20,
                                   bg=(109, 177, 255))
        self.openmenu = Button("Build List", (1130, 600),
                               self.Menu,
                               size=(120, 30),
                               font_size=20,
                               bg=(109, 177, 255))

        self.resourcebar = Bar("Moon Crystals: 100", (1080, 15),
                               size=(240, 30),
                               font_size=20,
                               bg=(176, 185, 186))
        self.supplybar = Bar("Units: 0/40", (1080, 45),
                             size=(240, 30),
                             font_size=20,
                             bg=(176, 185, 186))

        self.buildmenu = ToggleMenu((1140, 350),
                                    size=(160, 400),
                                    bg=(176, 185, 186),
                                    shown=False)

        self.buildrifleblaster = Button("RifleBlaster 100", (1130, 275),
                                        self.BRB,
                                        size=(120, 60),
                                        font_size=15,
                                        bg=(109, 177, 255))
        self.buildhorserifleblaster = Button("HorseRifleBlaster 200",
                                             (1130, 435),
                                             self.BHRB,
                                             size=(120, 60),
                                             font_size=12,
                                             bg=(109, 177, 255))
        self.buildspaceraider = Button("SpaceRaider 50", (1130, 195),
                                       self.BSR,
                                       size=(120, 60),
                                       font_size=15,
                                       bg=(109, 177, 255))
        self.buildtank = Button("Tank 300", (1130, 355),
                                self.BTANK,
                                size=(120, 60),
                                font_size=15,
                                bg=(109, 177, 255))

        self.buildmenutoggle = False

        self.buildqueue = StatBar(" ", (1090, 635),
                                  size=(200, 20),
                                  bg=(176, 185, 186),
                                  fg=(109, 177, 255))

        self.basehealth = StatBar(" ", (80, 45),
                                  size=(150, 20),
                                  bg=(176, 185, 186),
                                  fg=(219, 40, 0))

        self.ebasehealth = StatBar(" ", (80, 15),
                                   size=(150, 20),
                                   bg=(176, 185, 186),
                                   fg=(109, 177, 255))

        self.text = Text(15, 80, "Base Health", bold=True, fontSize=18)

        self.etext = Text(45, 80, "Enemy Base Health", bold=True, fontSize=18)

        self.buildmenu.AddButton(self.buildhorserifleblaster)
        self.buildmenu.AddButton(self.buildrifleblaster)
        self.buildmenu.AddButton(self.buildspaceraider)
        self.buildmenu.AddButton(self.buildtank)

        b = Boombox()
        b.PlayMusic("level6playmusic")
Exemple #8
0
 def __init__(self, txt):
     self.txt = txt
     SceneBase.__init__(self)
     # Scorelabel
     self.endscreenlabel = TextBox((480, 200, 240, 30), self.txt)
Exemple #9
0
 def __init__(self):
     SceneBase.__init__(self)
     self.menubutton = Button("BUTTON", (60,30), self.function)
Exemple #10
0
 def __init__(self):
     SceneBase.__init__(self)
Exemple #11
0
 def __init__(self):
     SceneBase.__init__(self)
     self.menubg = pygame.image.load("res/title.png").convert()
     self.menubg = pygame.transform.scale(self.menubg,
                                          (WINDOW_WIDTH, WINDOW_HEIGHT))
Exemple #12
0
 def __init__(self, level, score):
     SceneBase.__init__(self)
     self.level = level
     self.score = score