예제 #1
0
 def __init__(self, resource, song, screen, input, beatsPerBoard = 2):
     self.input = input
     self.song = song
     self.screen = screen
     self.downLeft = pygame.image.load(resource.fileName("images", "DownLeft.png"))
     self.downRight = pygame.image.load(resource.fileName("images", "DownRight.png"))
     self.upLeft = pygame.image.load(resource.fileName("images", "UpLeft.png"))
     self.upRight = pygame.image.load(resource.fileName("images", "UpRight.png"))
     
     self.downLeftActive = pygame.image.load(resource.fileName("images", "DownLeftActive.png"))
     self.downRightActive = pygame.image.load(resource.fileName("images", "DownRightActive.png"))
     self.upLeftActive = pygame.image.load(resource.fileName("images", "UpLeftActive.png"))
     self.upRightActive = pygame.image.load(resource.fileName("images", "UpRightActive.png"))
     
     self.center = pygame.image.load(resource.fileName("images", "Center.png"))    
     self.glow = pygame.image.load(resource.fileName("images", "Glow.png")) 
     
     # ALL IMAGES HAVE SAME HEIGHT AND WIDTH
     Constants.SPRITE_SIZE = self.glow.get_width()
     self.beatsPerBoard = beatsPerBoard
     self.backgroundColor = (0,0,0)
     self.score = 0
     self.font = PyGameHieroFont(resource.fileName("font", "font.fnt"))
     
     self.opacityGlow = []
     for i in range(0,4):
         self.opacityGlow.append(0)
     
     self.calculateCenterTargetsDistance()
     
     Constants.SQRT_2 = math.sqrt(2)
     
     self.targetsHypotenuse = math.sqrt(2*(self.centerTargetsDistance-Constants.SPRITE_SIZE)*(self.centerTargetsDistance-Constants.SPRITE_SIZE))
     self.arrowTimeRelation = self.beatsPerBoard/self.targetsHypotenuse
     
     self.sceneClock = pygame.time.Clock()
     
 
     self.song.play()
예제 #2
0
파일: demo.py 프로젝트: sseemayer/PyHiero
from pyhiero.pygamefont import PyGameHieroFont
import pygame, sys
from pygame.locals import *
import math

# init pygame
pygame.init()
screen = pygame.display.set_mode((800, 300))
pygame.display.set_caption('Hello World!')

# striped background to show off alpha blending
background = pygame.image.load("demo_bg.png")

# load some fonts
fonts = {
    "cabinsketch": PyGameHieroFont("examples/CabinSketch/CabinSketch.fnt"),
    "ranchers": PyGameHieroFont("examples/Ranchers/Ranchers.fnt"),
    "engagement": PyGameHieroFont("examples/Engagement/Engagement.fnt")
}

fnt_header = PyGameHieroFont("examples/Electrolize/Electrolize40.fnt")
fnt_body = PyGameHieroFont("examples/Electrolize/Electrolize16.fnt")

# create some demo text
blah = "Quick zephyrs blow, vexing daft Jim."

colors = {
    "cabinsketch": (128, 0, 0),
    "ranchers": (0, 128, 0, 128)  # alpha! 
    ,
    "engagement": (0, 0, 128)
예제 #3
0
 def __init__(self, input, game_brain, resource):
     super(Gameplay, self).__init__()
     self.input = input
     self.game_brain = game_brain
     self.fontScore = PyGameHieroFont(resource.fileName("font", "font.fnt"))