Example #1
0
def screen_function(current_luck):
    pygame_functions.screenSize(SCREEN_SIZE_X, SCREEN_SIZE_Y, fullscreen=False)
    cards = init_cards()

    card_sprites = show_cards(current_luck, cards)
    print(detect_choice(card_sprites))

    wait_function()
Example #2
0
    def __init__(self):
        self._init_pygame()
        self.screen = screenSize(1000, 700)
        self.background = load_sprite("space", False)
        self.clock = pygame.time.Clock()
        self.font = pygame.font.Font(None, 64)
        self.message = ""
        self.destroyed_small = 0
        self.score = 0
        self.scoretext = self.font.render("Score = " + str(self.score), 1,
                                          (255, 0, 0))

        file = 'C://Users//ActionICT//PycharmProjects//Asteroids//assets//music//jlbrock44_-_Stars_Below_Us.mp3'
        pygame.init()
        pygame.mixer.init()
        pygame.mixer.music.load(file)
        pygame.mixer.music.play(
            -1)  # If the loops is -1 then the music will repeat indefinitely.

        self.asteroids = []
        self.bullets = []
        self.spaceship = Spaceship((400, 300), self.bullets.append)

        for _ in range(6):
            while True:
                position = get_random_position(self.screen)
                if (position.distance_to(self.spaceship.position) >
                        self.MIN_ASTEROID_DISTANCE):
                    break

            self.asteroids.append(Asteroid(position, self.asteroids.append))
Example #3
0
# game

import pygame_functions as pg

pg.screenSize(800,800)
pg.setBackgroundColour((255,60,70))

pg.endWait()

def changeGameStatus(status):
    global game_status
    game_status = status


pgf.setAutoUpdate(False)
w = 672
h = 744
spalten, zeilen = w // 24, h // 24
raster_w = 24
raster_h = 24
zellen = spalten * zeilen

pgf.screenSize(w, h)
pgf.setBackgroundImage("Teil_17_pacman.png")
pacman = Pacman(sync(321, 420))
blinky = Ghosts("blinky_tileset2.png", sync(348, 276))
pinky = Ghosts("pinky_tileset2.png", sync(300, 348))
inky = Ghosts("inky_tileset2.png", sync(348, 348))
clyde = Ghosts("clyde_tileset2.png", sync(396, 348))
ghosts = [blinky, pinky, inky, clyde]


def dotsAufbauen():
    global dots
    dots = {}
    for i, zahl in enumerate(grid):
        if zahl == 1:
            x, y = i2xy(i)
Example #5
0
WAIT_BEFORE_RESTART = 5000
restartCounter = 0

#SCORE
MIN_SCORE_POINT = 50
SCORE_FOR_POINT = 100
SCORE = -100
time_since_last_point = pgf.clock()

#TICK RATE
ADD_TICK_RATE = 10
START_RATE = 120
TICK_RATE = START_RATE - ADD_TICK_RATE

#setup Screen
pgf.screenSize(BREITE, HÖHE)
pgf.setBackgroundImage('./img/level.png')
pgf.setAutoUpdate(False)

#setup start
snakeman = Snakeman("Snake-Man", (SNAKEMAN_START_X, SNAKEMAN_START_Y))
snakeman.addBody()
snakeman.addBody()
punkt = None
spielraster = SPIELRASTER_START.copy()

#gameloop
while True:
    #geschwindigkeit setzten
    pgf.tick(TICK_RATE)
Example #6
0
FPS = 500  # frame per second , 빠른 진화속도를 위해 높은 프레임

trikey = 0  # 메뉴 선택 변수
dlt = True
directions = {
    0: (1, 0),
    1: (-1, 0),
    2: (0, -1),
    3: (0, 1)
}  # 각 방향에 해당하는 좌표 변화 값
width, height = 672, 812
grid = 24
column = width // grid  # 맵 구조 열 개수
low = height // grid  # 맵 구조 행 개수

pgf.screenSize(width, height)
score = 0

main1 = pygame.image.load('Resource\Main_image1.png')
main2 = pygame.image.load('Resource\Main_image2.png')

nextAnimation = pgf.clock() + 100

clear = False


# 게임화면에 현재 점수를 표기하는 함수
def writeScore(count):
    global score
    pygame.draw.rect(pgf.screen, (0, 0, 0), [500, 760, 300, 100])
    score += count
Example #7
0
def init_screen(dimension):
    screen = pygf.screenSize(dimension, dimension)
    pygf.setAutoUpdate(False)

    return screen
Example #8
0
    def __init__(self, nmax, filename):
        # Variaveis de Controle
        self.nmax = nmax
        self.mouse_state_plus = False
        self.mouse_state_minus = False
        #self.alg
        self.sprite_list = []
        self.shuffler = shuffle.Shuffle(self.nmax)
        self.imagesize = c.IMAGE_SIZE
        self.time_elapsed = 0

        # Inicializacao Pygame
        pyf.screenSize(c.SCREEN_WIDTH, c.SCREEN_HEIGHT)
        pyf.setBackgroundColour(c.GRAY)

        # Instancia lista de sprites
        for i in range(0, nmax * nmax):
            self.sprite_list.append(
                pyf.makeSprite("images/" + filename + str(i) + ".png"))

        # Carrega sprites padroes
        self.plus = pyf.makeSprite("images/plus.png")
        self.minus = pyf.makeSprite("images/minus.png")
        self.shuffle_button = pyf.makeSprite("images/shuffle.png")
        self.BFS_button = pyf.makeSprite("images/BFS.png")
        self.DFS_button = pyf.makeSprite("images/DFS.png")
        self.DFS_IT_button = pyf.makeSprite("images/BFS_IT.png")
        self.A1_button = pyf.makeSprite("images/A_H1.png")
        self.A2_button = pyf.makeSprite("images/A_H2.png")
        self.text_shuffler_label = pyf.makeLabel(u"Número de iterações: ", 30,
                                                 50, 690, "black", "Arial",
                                                 "clear")
        self.text_time = pyf.makeLabel(u"Tempo de execução: ", 30, 700, 400,
                                       "black", "Arial", "clear")
        self.text_time2 = pyf.makeLabel("segundos", 30, 980, 400, "black",
                                        "Arial", "gray")
        self.text_memory = pyf.makeLabel(u"Memória utilizada: ", 30, 735, 450,
                                         "black", "Arial", "clear")
        #self.text_moves = pyf.makeLabel("Movimentos Realizados: ", 30, 735, 500, "black", "Arial", "clear")
        #self.text_moves2 = pyf.makeLabel("", 30, 735, 500, "black", "Arial", "gray")
        self.text_memory2 = pyf.makeLabel("bytes", 30, 980, 450, "black",
                                          "Arial", "gray")
        self.number_shuffler_label = pyf.makeLabel(str(c.IT), 30, 332, 692,
                                                   "black", "Arial", "clear")

        # Transforma sprites para tamanhos maiores que 3x3
        if self.nmax > 3:
            self.initial_transformation()

        # Posiciona Sprites
        self.initial_position()
        pyf.moveSprite(self.shuffle_button, 570, 710, True)
        pyf.moveSprite(self.plus, 515, 710, True)
        pyf.moveSprite(self.minus, 460, 710, True)
        pyf.moveSprite(self.BFS_button, 800, 100, True)
        pyf.moveSprite(self.DFS_button, 1010, 100, True)
        pyf.moveSprite(self.DFS_IT_button, 900, 210, True)
        pyf.moveSprite(self.A1_button, 800, 320, True)
        pyf.moveSprite(self.A2_button, 1010, 320, True)

        # Mostra sprites na tela
        for i in range(0, nmax * nmax):
            pyf.showSprite(self.sprite_list[i])
            # print(i)
        pyf.showSprite(self.shuffle_button)
        pyf.showSprite(self.plus)
        pyf.showSprite(self.minus)
        pyf.showLabel(self.text_shuffler_label)
        pyf.showLabel(self.number_shuffler_label)
        pyf.showLabel(self.BFS_button)
        pyf.showLabel(self.DFS_button)
        pyf.showLabel(self.DFS_IT_button)
        pyf.showLabel(self.A1_button)
        pyf.showLabel(self.A2_button)
        pyf.showLabel(self.text_time)
        pyf.showLabel(self.text_time2)
        pyf.showLabel(self.text_memory)
        pyf.showLabel(self.text_memory2)
        #pyf.showLabel(self.text_moves)
        #pyf.showLabel(self.text_moves2)
        pyf.transformSprite(self.shuffle_button, 0, 0.25)
        pyf.transformSprite(self.plus, 0, 0.25)
        pyf.transformSprite(self.minus, 0, 0.1)