Esempio n. 1
0
 def healthManager(self, picture=settings.heart):
     x = 5
     for i in range(self.health):
         win.blit(picture, (x, 5))
         x += 40
     if self.health == 0:
         settings.gamemode = 0
     return 0
Esempio n. 2
0
def pauseMenu(clicked, player):
    textToScreen('PAUSED', (display[0] / 2, display[1] / 2 - 200), 50, white)
    textToScreen('HIGHSCORE: ' + str(player.highscore),
                 (display[0] / 2, display[1] / 2 - 145), 72, white)
    textToScreen('Your score: ' + str(player.score),
                 (display[0] / 2, display[1] / 2 - 100), 20, white)
    textToScreen('click anywhere to continue',
                 (display[0] / 2, display[1] / 2 - 80), 20, white)
    win.blit(settings.resume_button,
             (display[0] / 2 - settings.resume_button.get_width() / 2,
              display[1] / 2 - settings.resume_button.get_height() / 2))
    pygame.display.update()
    if clicked:
        settings.gamemode = 1
Esempio n. 3
0
def homeMenu(clicked, player):
    win.fill(black)
    win.blit(settings.background, (0, 0))
    # textToScreen(win, 'SUPER AWESOME OMEGA RUN', (display[0]/2, display[1]/2-200), 50, white)
    textToScreen('HIGHSCORE: ' + str(player.highscore),
                 (display[0] / 2, display[1] / 2 + 20), 72, golden)
    textToScreen('Your score: ' + str(player.score),
                 (display[0] / 2, display[1] / 2 + 60), 32, golden)
    textToScreen('Click Anywhere To Start',
                 (display[0] / 2, display[1] / 2 + 80), 20, oceanblue)
    pygame.display.update()
    if clicked:
        player.score = 0
        player.health = settings.start_health
        settings.gamemode = 1
def gameLoop():
    # win.fill(oceanblue)
    win.blit(wallpaper, (0, 0))
    updateObstacles(player)
    player.update()
    player.draw()
import ui
from colors import *
from player import Player
from obstacle import (Obstacle, updateObstacles)
from Loading_Screen import DrawBar
import settings
from settings import (win, thirds)

pygame.init()

# {

player = Player(white)
wallpaper = pygame.image.load("../pictures/wallpaper.jpg")
wallpaper = pygame.transform.scale(wallpaper, (800, 600))
win.blit(wallpaper, (0, 0))


def gameLoop():
    # win.fill(oceanblue)
    win.blit(wallpaper, (0, 0))
    updateObstacles(player)
    player.update()
    player.draw()


def keyPressed():
    if keys[pygame.K_a] or keys[pygame.K_LEFT]:
        player.pos.x -= 10
    if keys[pygame.K_d] or keys[pygame.K_RIGHT]:
        player.pos.x += 10
Esempio n. 6
0
def textToScreen(msg, pos, size, col=white):
    font = pygame.font.SysFont(None, size)
    text = font.render(msg, True, col)
    text_rect = text.get_rect(center=pos)
    win.blit(text, text_rect)