예제 #1
0
    def __init__(self):
        """Inicjaluzuję piłkę"""
        super(Ball, self).__init__(image=Ball.image,
                                    x=games.screen.width / 2,
                                    y=games.screen.height / 2,
                                    dy=Ball.speed,
                                    dx=Ball.speed)

        #utwórz wynik punktowy 1
        self.score_1 = games.Text(value=0,
                                  size=30,
                                  color=color.white,
                                  top=5,
                                  right=games.screen.width - 10,
                                  is_collideable=False)
        games.screen.add(self.score_1)

        #utwórz wynik punktowy 2
        self.score_2 = games.Text(value=0,
                                  size=30,
                                  color=color.white,
                                  top=5,
                                  right=games.screen.width - 630,
                                  is_collideable=False)
        games.screen.add(self.score_2)
예제 #2
0
    def __init__(self):
        super(Bucket, self).__init__(image=Bucket.image,
                                     x=games.mouse.x,
                                     bottom=games.screen.height)
        self.score = games.Text(value=0,
                                size=25,
                                color=color.black,
                                top=5,
                                right=games.screen.width - 10)
        games.screen.add(self.score)

        self.lives = games.Text(value=3,
                                size=25,
                                color=color.black,
                                top=25,
                                right=games.screen.width - 10)

        self.life_status = games.Message(value="Lives: ",
                                         size=25,
                                         color=color.black,
                                         top=25,
                                         right=games.screen.width - 25)

        games.screen.add(self.lives)
        games.screen.add(self.life_status)
예제 #3
0
 def __init__(self):
     super(Ball, self).__init__(image=self.image, x=650, y=325,
                                dx=4.5, dy=4.5)
     if Ball.time == 100:
         self.show_time = games.Text(value=Ball.time, size=40,
                                     color=color.red, x=652.5, y=35)
         games.screen.add(self.show_time)
예제 #4
0
    def __init__(self):
        super().__init__(x = 200, y = 50, dx = 0, dy = 2, image = Bird.image)
        Bird.score = 0

        #score text
        self.score_text = games.Text(value = "Score : 0", size = 30, color = color.blue, left = 30, top = 30)
        games.screen.add(self.score_text)
예제 #5
0
class Yellow_Brick(games.Sprite):

    bricks = []
    score = games.Text(value=0,
                       size=40,
                       color=color.yellow,
                       right=games.screen.width - 20,
                       top=20)
    games.screen.add(score)

    def __init__(self, image, angle, x, y):
        super().__init__(image, angle, x, y)
        self.bricks.append(self)

    def update(self):
        self.destruction()

    def destruction(self):
        for ball in self.overlapping_sprites:
            ball.handle_collision()
            self.score.value += 1
            self.destroy()
            self.bricks.remove(self)
            if self.bricks == []:
                brick_wall()
예제 #6
0
    def __init__(self):
        super(Pan, self).__init__(image=Pan.image,
                                  x=games.mouse.x,
                                  bottom=games.screen.height)

        self.score = games.Text(value=0, size=40, color=color.black, top=5, right=games.screen.width-10)
        games.screen.add(self.score)
예제 #7
0
    def __init__(self):
        # set level
        self.level = 0
        # load sound for level advance
        self.sound = games.load_sound("sounds/mvm_used_powerup.ogg")
        # create score
        self.score = games.Text(value=0,
                                size=30,
                                color=color.white,
                                top=5,
                                right=games.screen.width - 10,
                                is_collideable=False)
        games.screen.add(self.score)
        self.create_ship()

        start_message1 = games.Message(
            value="Move your Ship with the Arrow Keys.",
            size=36,
            color=color.red,
            x=games.screen.width / 2,
            y=games.screen.height / 2,
            lifetime=3 * games.screen.fps,
            is_collideable=False)
        start_message2 = games.Message(
            value="Press the Space Bar to fire a laser.",
            size=36,
            color=color.red,
            x=games.screen.width / 2,
            y=games.screen.height * 3 / 4,
            lifetime=3 * games.screen.fps,
            is_collideable=False)
        games.screen.add(start_message1)
        games.screen.add(start_message2)
예제 #8
0
파일: pong.py 프로젝트: snakedlover/Games
	def __init__(self,pos,scorex,images,a,b):
		super(Bar,self).__init__(image=images,y=games.screen.height/2,x=pos)
		self.score=games.Text(value=0,size=60,color=color.black,x=scorex,y=35)
		games.screen.add(self.score)
		self.change=0
		self.key=0
		self.t=a
		self.g=b
 def __init__(self):
     """ Initialize Pan object and create Text object for score. """
     super(Pan, self).__init__(image = Pan.image,
                               x = games.mouse.x,
                               bottom = games.screen.height)
     
     self.score = games.Text(value = 0, size = 25, color = color.black,
                             top = 5, right = games.screen.width - 10)
     games.screen.add(self.score)
예제 #10
0
 def __init__(self, game, x, y):
     super(Ship, self).__init__(image=Ship.ship_image, x=x, y=y)
     self.game = game
     self.missile_wait = 0
     self.lives = games.Text(value="Lives: " + str(Ship.lives),
                             size=25,
                             color=color.white,
                             top=25,
                             right=games.screen.width - 10,
                             is_collideable=False)
     games.screen.add(self.lives)
예제 #11
0
 def __init__(self):
     self.level = 0
     self.sound = games.load_sound("snd/level.wav")
     self.lives = games.Text(value=3,
               size=50,
               color=color.red,
               top=5,
               right=50,
               is_collideable=False)
     self.score = games.Text(value=0,
               size=30,
               color=color.white,
               top=5,
               right=games.screen.width - 10,
               is_collideable=False)
     self.ufoscore = 1000
     games.screen.add(self.score)
     games.screen.add(self.lives)
     self.player = Ship(self,games.screen.width/2, games.screen.height/2)
     games.screen.add(self.player)
예제 #12
0
 def __init__(self):
     """Inicjalizacja obiektu gracza"""
     super(Player, self).__init__(image=Player.image,
                                  x=games.mouse.x,
                                  bottom=games.screen.height)
     self.score = games.Text(value=0,
                             size=50,
                             color=color.black,
                             top=5,
                             right=games.screen.width - 10)
     games.screen.add(self.score)
예제 #13
0
 def __init__(self, x, y=50):
     super(Square, self).__init__(image=Square.image,
                                  x=x,
                                  y=y,
                                  dy=Square.speed)
     self.score = games.Text(value=0,
                             size=25,
                             color=color.black,
                             top=5,
                             right=games.screen.width - 10,
                             is_collideable=False)
     games.screen.add(self.score)
예제 #14
0
    def __init__(self):
        self.level = 0
        self.score = games.Text(value=0,
                                size=30,
                                color=color.white,
                                top=5,
                                right=games.screen.width - 10,
                                is_collideable=False)
        games.screen.add(self.score)

        self.ship = Ship(game=self, x=games.screen.width / 2)
        games.screen.add(self.ship)
예제 #15
0
 def __init__(self, game):
     super(Ship, self).__init__(image=Ship.image,
                                x=games.mouse.x,
                                bottom=games.screen.height)
     self.missile_wait = 0
     self.lives = games.Text(value="Lives: " + str(Ship.lives),
                             size=25,
                             color=color.white,
                             top=25,
                             right=games.screen.width - 10,
                             is_collideable=False)
     games.screen.add(self.lives)
     self.game = game
    def __init__(self):
        """Initializes the game"""
        # set level
        self.level = 0

        # load sound for level advance
        self.sound = games.load_sound('./res/level.wav')

        # create score
        self.score = games.Text(value=0, size=30, color=color.white, top=5, right=games.screen.width - 10,
                                is_collideable=False)
        games.screen.add(self.score)
        self.score_legend = games.Text(value="score: ", size=30, color=color.white, top=5,
                                       right=self.score.left - 5, is_collideable=False)
        games.screen.add(self.score_legend)

        # create player's ship
        self.ship = Ship(game=self, x=games.screen.width / 2, y=games.screen.height / 2)
        games.screen.add(self.ship)

        self.asteroid_aims = False
        self.alienship_aims = False
예제 #17
0
class Pan(games.Sprite):
    """Перемещение мышью сковородки"""
    image = games.load_image("pan.bmp") # Загрзука картинки сковородки в переменную image
    score = games.Text(value=0, size=25, color=color.red, top=5, right=games.screen.width - 10)

    def __init__(self):
        """Инициализация объектов Pan и создания объекта Text для отображения счёта"""
        super(Pan, self).__init__(image=Pan.image, x = games.mouse.x, y = games.screen.height - 30)  # вызов конструктора класса Sprite
        self.upds_message = games.Message(value="Скорость повышена!",
                                                     size=50,
                                                     color=color.red,
                                                     x=games.screen.width / 2,
                                                     y=games.screen.height / 2,
                                                     lifetime=2*games.screen.fps,
                                                     after_death = self.destroy
                                                     )
        games.screen.add(self.score)

    def update(self):
        self.x = games.mouse.x
        if self.left < 0:  # если сковорода выходит за левое поле картинки
            self.left = 0  # сковорода возвращается в левый край экрана
        if self.right > games.screen.width:  # если сковорода выходит за правое поле картинки
            self.right = games.screen.width  # сковорода возвращается в правый край экрана
        self.check_catch()
        self.update_speed()
        self.distance()

    def check_catch(self):
        """Проверка пересечения спрайтов - сковороды и пиццы"""
        for pizza in self.overlapping_sprites:  # перебор всех спрайтов, пересекающихся со сковородкой
            self.score.value += 10
            self.score.right = games.screen.width - 10  # размещение счёта в правом углу, независимо от кол-ва цифр
            pizza.handle_caught()

    def update_speed(self):
        if self.score.value > 30:
            Pizza.speed = 2
            Chef.time_til_drop = int(Pizza(x=self.x).height * 1.8 / Pizza.speed)

    def distance(self):
        if self.score.value > 50:
            self.y = games.screen.height - 100


    def tick(self):
        if 30 < self.score.value < 80:
            games.screen.add(self.upds_message)

    def destroy(self):
        self.upds_message.destroy()
예제 #18
0
        def __init__(self):
            # create level variable
            self.level = 1
            # create score variable
            self.score = 0

            # create visible score label in upper right corner
            self.score_label = games.Text(value="Score: 0",
                                          size=40,
                                          color=color.white,
                                          top=5,
                                          right=games.screen.width - 10,
                                          is_collideable=False)
            games.screen.add(self.score_label)

            # create visible level label in upper middle section
            self.level_label = games.Text(value="Level 1",
                                          size=40,
                                          color=color.white,
                                          x=games.screen.width / 2,
                                          y=20,
                                          is_collideable=False)
            games.screen.add(self.level_label)

            # add ship to the screen and place it in the middle
            self.the_ship = Ship(game=self,
                                 x=games.screen.width / 2,
                                 y=games.screen.height - 200)
            games.screen.add(self.the_ship)

            # create visible lives label in upper left corner
            self.lives_label = games.Text(value=self.the_ship.lives,
                                          size=40,
                                          color=color.white,
                                          x=55,
                                          y=20,
                                          is_collideable=False)
            games.screen.add(self.lives_label)
예제 #19
0
파일: game.py 프로젝트: Air-t/car-game
 def __init__(self, *args, **kwargs):
     """ Inicjalizuj obiekt klasy Car. """
     super(Car, self).__init__(
         image=Car.IMAGE,
         x=games.screen.width / 2,
         y=games.screen.height / 2,
     )
     self.score = games.Text(value=0,
                             size=40,
                             color=color.red,
                             top=5,
                             right=games.screen.width - 10,
                             is_collideable=False)
     games.screen.add(self.score)
 def __init__(self):
     self.level = 0
     #self.sound = games.load_sound("sounds/filenamehere")
     self.score = games.Text(value=0,
                             size=30,
                             color=color.white,
                             top=5,
                             right=games.screen.width - 10,
                             is_collideable=False)
     games.screen.add(self.score)
     self.ship = Ship(game=self,
                      x=games.screen.width / 2,
                      y=games.screen.height / 2)
     games.screen.add(self.ship)
예제 #21
0
 def __init__(self):
     self.score = games.Text(value=0,
                             size=30,
                             top=5,
                             color=color.white,
                             right=games.screen.width - 10,
                             is_collideable=False)
     games.screen.add(self.score)
     self.startup = games.load_sound("Sounds/FX/startup.wav")
     self.startup.play()
     self.sound = games.load_sound("Sounds/FX/level.wav")
     self.theme = games.music.load("Sounds/Theme/far.wav")
     self.level = 0
     self.birth_steve()
예제 #22
0
    def __init__(self):
        super(Red, self).__init__(image=Red.image,
                                  x=games.screen.width - 40,
                                  y=games.screen.height / 2,
                                  angle=180)
        self.missile_wait = 0

        self.score = games.Text(value=5,
                                size=50,
                                color=color.red,
                                x=games.screen.width - 40,
                                y=40,
                                is_collideable=False)

        games.screen.add(self.score)
예제 #23
0
    def __init__(self):
        super(Blue, self).__init__(image=Blue.image,
                                   x=40,
                                   y=games.screen.height / 2)

        self.missile_wait = 0

        self.score = games.Text(value=5,
                                size=50,
                                color=color.blue,
                                x=40,
                                y=40,
                                is_collideable=False)

        games.screen.add(self.score)
예제 #24
0
파일: game.py 프로젝트: Air-t/car-game
 def is_over(self):
     """Sprawdź czy gra się kończy"""
     if self.score.value == 100:
         self.win = games.Text(value="WYGRAŁEŚ!",
                               size=80,
                               color=color.green,
                               y=games.screen.height / 2,
                               x=games.screen.width / 2,
                               is_collideable=False)
         games.screen.add(self.win)
         self.score.destroy()
         games.screen.background = pygame.Surface((640, 640))
         return True
     else:
         return False
예제 #25
0
 def __init__(self):
     '''Initialize Pan and create text counter'''
     super(Pan, self).__init__(
         image = Pan.pan_image,
         x = games.mouse.x,
         bottom= games.screen.height
     )
     self.score = games.Text(
         value = 0,
         size = 25,
         color = color.black,
         top=5,
         right=games.screen.width - 10
     )
     games.screen.add(self.score)
  
     self.player_level = games.Text(
         value = Chef.level,
         size = 25,
         color = color.black,
         top=5,
         right=20
     )
     games.screen.add(self.player_level)
예제 #26
0
    def __init__(self):
        self.score = games.Text(value=0,
                                size=30,
                                color=color.white,
                                top=5,
                                right=games.screen.width - 10,
                                is_collideable=False)

        games.screen.add(self.score)

        self.sound = games.load_sound("sounds/soundfx/levelup1.wav")

        self.level = 0

        self.create_ship()
예제 #27
0
    def update(self):
        #Physics
        self.a -= (MOVING_FRICTION if self.a else SLOWING_FRICTION) * self.v
        self.v += self.a
        self.v = (max if self.v > 0 else min)(0, self.v)

        #Controls
        if not self.frozen:
            if games.K_RIGHT in self.keys: self.angle += ROT_SPEED
            if games.K_LEFT in self.keys: self.angle -= ROT_SPEED
            self.a = ACCEL if games.K_UP in self.keys else 0

        #Compute component velocity vectors in Cartesian form
        self.dx, self.dy = self.convert(self.angle, self.v)

        #Check Wrapping
        self.check_wrap()

        for i in self.overlapping_sprites:
            if isinstance(i, Missile):
                self.lose_health()
                i.destroy()

        if self.health <= 0:
            global GAME_OVER
            GAME_OVER = True

        if GAME_OVER:
            self.frozen = True
            if self.num == self.game.num:
                games.screen.add(
                    games.Message("GAME OVER",
                                  200,
                                  color.white,
                                  x=games.screen.width / 2,
                                  y=games.screen.height / 2,
                                  lifetime=50,
                                  after_death=games.screen.quit))

                games.screen.add(
                    games.Text("You " + ("Won" if self.health else "Lost") +
                               "!",
                               100,
                               color.white,
                               x=games.screen.width / 2,
                               y=200 * SCALE_RATIO))
예제 #28
0
    def __init__(self):
        self.lvl = 0

        self.sound = games.load_sound("reszta/poziom.wav")

        self.score = games.Text(value=0,
                                size=50,
                                color = color.red,
                                top=games.screen.height-460,
                                right=games.screen.width-10,
                                is_collideable=False)
        games.screen.add(self.score)

        self.ship = Ship(game =self,
                         x = games.screen.width/2,
                         y = games.screen.height/2)
        games.screen.add(self.ship)
예제 #29
0
    def __init__(self):
        #set level
        self.level = 0
        #load sound for level advance
        self.sound = games.load_sound("sounds/level.wav")
        #create score
        self.score = games.Text(value= 0,
                   size = 30,
                   color = color.white,
                   top = 5,
                   right = games.screen.width - 10,
                   is_collideable = False)
        games.screen.add(self.score)

        self.ship = Ship(game = self,
                           x = games.screen.width/2,
                           y = games.screen.height/2)
        games.screen.add(self.ship)
예제 #30
0
    def __init__(self):
        """Initialize the game"""
        self.level = 0
        self.sound = games.load_sound("./Sound/level.wav")
        self.score = games.Text(value = 0,
                                size = 30,
                                color = color.white,
                                top = 5,
                                right = games.screen.width - 10,
                                is_collideable = False)

        games.screen.add(self.score)

        self.ship = Ship(game = self,
                         x = games.screen.width / 2,
                         y = games.screen.height / 2)

        games.screen.add(self.ship)