Ejemplo n.º 1
0
 def __init__(self, loc, image_master, image_covered):
     self.image_master = pygame.image.load(get_res_path(image_master))
     self.image_covered = pygame.image.load(get_res_path(image_covered))
     self.image = self.image_master
     self.loc = loc
     self.rect = self.image.get_rect()
     self.rect.center = self.loc
Ejemplo n.º 2
0
 def __init__(self, loc, image_master, image_covered):
     self.image_master = pygame.image.load(get_res_path(image_master))
     self.image_covered = pygame.image.load(get_res_path(image_covered))
     self.image = self.image_master
     self.loc = loc
     self.rect = self.image.get_rect()
     self.rect.center = self.loc
Ejemplo n.º 3
0
 def __init__(self, turn_number, screen, game_surface, score_surface, score):
     # top-level properties
     self.screen = screen
     self.game_surface = game_surface
     self.score_surface = score_surface
     self.score = score
     # self properties
     self.turn_number = turn_number
     self.active_dart = Dart()
     self.darts_remain = 2  # one is already active
     self.dropped_darts = []
     self.font = pygame.font.Font(get_res_path('EraserRegular.ttf'), 32)
     self.splash_font = pygame.font.Font(
         get_res_path('EraserRegular.ttf'), 52
     )
Ejemplo n.º 4
0
 def __init__(self, turn_number, screen, game_surface, score_surface,
              score):
     # top-level properties
     self.screen = screen
     self.game_surface = game_surface
     self.score_surface = score_surface
     self.score = score
     # self properties
     self.turn_number = turn_number
     self.active_dart = Dart()
     self.darts_remain = 2  # one is already active
     self.dropped_darts = []
     self.font = pygame.font.Font(get_res_path('EraserRegular.ttf'), 32)
     self.splash_font = pygame.font.Font(get_res_path('EraserRegular.ttf'),
                                         52)
Ejemplo n.º 5
0
  You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. """

""" dart.py

Includes class Dart to manage darts in game
"""

import random

import pygame

from utils import get_res_path


IMG_DART = pygame.image.load(get_res_path('dart.png'))
IMG_DART_DROPPED = pygame.image.load(get_res_path('dart_dropped.png'))

IN_GAME = 0
IN_FLY = 1
DROPPED = 2

FPS = 30


class Dart(pygame.sprite.Sprite):

    def __init__(self):
        self.image = IMG_DART
        self.base = (0, 0)
        self.loc = (0., 0.)
Ejemplo n.º 6
0
from pygame.locals import QUIT, MOUSEBUTTONDOWN, KEYDOWN, K_ESCAPE

from utils import get_res_path

from dart import Dart
from score import Score
from hiscores import HiScores
from button import Button

from globals import CLR_RED


FPS = 30

IMG_DARTSBOARD = pygame.image.load(get_res_path('dartsboard.png'))
IMG_DARTSBOARD_OFF = pygame.image.load(get_res_path('dartsboard_off.png'))
IMG_CHALKBOARD = pygame.image.load(get_res_path('chalkboard.png'))


class GameInterruptedError(BaseException):
    pass


class GameEscapedError(BaseException):
    pass


class Game(object):

    def __init__(self, screen):
Ejemplo n.º 7
0
 GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. """
""" dart.py

Includes class Dart to manage darts in game
"""

import random

import pygame

from utils import get_res_path

IMG_DART = pygame.image.load(get_res_path('dart.png'))
IMG_DART_DROPPED = pygame.image.load(get_res_path('dart_dropped.png'))

IN_GAME = 0
IN_FLY = 1
DROPPED = 2

FPS = 30


class Dart(pygame.sprite.Sprite):
    def __init__(self):
        self.image = IMG_DART
        self.base = (0, 0)
        self.loc = (0., 0.)
        self.radius = 30
Ejemplo n.º 8
0
 def __init__(self):
     self.font = pygame.font.Font(get_res_path('EraserRegular.ttf'), 24)
     self.scores = []
     for i in range(10):
         self.scores.append({'name': 'Unknown', 'score': 0})
     self.read()
Ejemplo n.º 9
0
 def __load_static_sound(path):
     sound_media = pyglet.media.load(utils.get_res_path(path))
     return pyglet.media.StaticSource(sound_media)
Ejemplo n.º 10
0
 def __init__(self):
     self.total = 0
     self.drops = []
     self.font = pygame.font.Font(get_res_path('EraserRegular.ttf'), 24)
Ejemplo n.º 11
0
import pygame

from pygame.locals import QUIT, MOUSEBUTTONDOWN, KEYDOWN, K_ESCAPE

from utils import get_res_path

from dart import Dart
from score import Score
from hiscores import HiScores
from button import Button

from globals import CLR_RED

FPS = 30

IMG_DARTSBOARD = pygame.image.load(get_res_path('dartsboard.png'))
IMG_DARTSBOARD_OFF = pygame.image.load(get_res_path('dartsboard_off.png'))
IMG_CHALKBOARD = pygame.image.load(get_res_path('chalkboard.png'))


class GameInterruptedError(BaseException):
    pass


class GameEscapedError(BaseException):
    pass


class Game(object):
    def __init__(self, screen):
        self.screen = screen