Beispiel #1
0
import pyglet
import screen
import messenger
import button
import config
import text
from utility import load_join_i

# Non-divided sprite_sheet
SPRITE_SHEET_MERGED = load_join_i(["resources", "art", "sprite_sheet.png"])

# Divided sprite_sheet
SPRITE_SHEET_DIVIDED = pyglet.image.ImageGrid(SPRITE_SHEET_MERGED, 8, 8)

IMAGES = {}
IMAGES["background"] = load_join_i(["resources", "art", "background1.png"])
IMAGES["menu_button"] = load_join_i(["resources", "art", "menu_button.png"])
IMAGES["tiber"] = SPRITE_SHEET_DIVIDED[63]
IMAGES["gwen"] = SPRITE_SHEET_DIVIDED[62]


class CharScreen(screen.AbstractScreen):
    def __init__(self):
        messenger.Messenger.charScreen = self
        self.background = IMAGES["background"]
        self.font_size = 30
        self.make_descriptions()
        self.menu_button = button.Button(image=IMAGES["menu_button"], x=40, y=40)
        self.menu_button.command = lambda: messenger.Messenger.change_mode("MenuScreen")

    def on_draw(self):
Beispiel #2
0
import pyglet
import config
import messenger
import random
import screen
from utility import list_pj, load_join_m, load_join_i
from pyglet.gl import *  #Neccesary to prevent linear scaling

#Non-divided sprite_sheet
SPRITE_SHEET_MERGED = load_join_i(["resources", "art", "sprite_sheet.png"])

#Divided sprite_sheet
SPRITE_SHEET_DIVIDED = pyglet.image.ImageGrid(SPRITE_SHEET_MERGED, 8, 8)

IMAGES = {}  #A hash of all the images in the game with the appropriate names

PLAYER_IMAGES = [SPRITE_SHEET_DIVIDED[63], SPRITE_SHEET_DIVIDED[62]]

PRESENT_IMAGES = [
    SPRITE_SHEET_DIVIDED[56], SPRITE_SHEET_DIVIDED[57],
    SPRITE_SHEET_DIVIDED[58]
]

SOUNDS = dict(
    zip(["beep", "end", "crumple"],
        map(lambda x: pyglet.media.load(list_pj(x), streaming=False),
            [["resources", "music", "bell-ring-01.mp3"],
             ["resources", "music", "bell-ringing-01.mp3"],
             ["resources", "music", "paper-rustle-8.mp3"]])))

BACKGROUND_IMAGES = map(load_join_i, [["resources", "art", "background1.png"],
Beispiel #3
0
import pyglet
import screen
import button
import messenger
import config
import text
from utility import load_join_i

IMAGES = {}
IMAGES["background"] = load_join_i(["resources", "art", "background1.png"])
IMAGES["menu_button"] = load_join_i(["resources", "art", "menu_button.png"])

class CreditScreen(screen.AbstractScreen):
    def __init__(self):
        messenger.Messenger.creditScreen = self
        self.font_size = 40
        self.color = (0, 0, 0, 255)
        self.background = IMAGES["background"]
        self.make_buttons()
        self.make_labels()

    def on_draw(self):
        self.background.blit(0, 0)
        self.menu_button.draw()
        self.score_label.draw()
        self.score_comment.draw()

    def make_score_comment(self):
        score = messenger.Messenger.gameScreen.score
        if score == 0:
            _text = """
Beispiel #4
0
import pyglet
import screen
import messenger
import button
import config
import text
from utility import load_join_i

# Non-divided sprite_sheet
SPRITE_SHEET_MERGED = load_join_i(["resources", "art", "sprite_sheet.png"])

# Divided sprite_sheet
SPRITE_SHEET_DIVIDED = pyglet.image.ImageGrid(SPRITE_SHEET_MERGED, 8, 8)

IMAGES = {}
IMAGES["background"] = load_join_i(["resources", "art", "background1.png"])
IMAGES["menu_button"] = load_join_i(["resources", "art", "menu_button.png"])
IMAGES["tiber"] = SPRITE_SHEET_DIVIDED[63]
IMAGES["gwen"] = SPRITE_SHEET_DIVIDED[62]


class CharScreen(screen.AbstractScreen):
    def __init__(self):
        messenger.Messenger.charScreen = self
        self.background = IMAGES["background"]
        self.font_size = 30
        self.make_descriptions()
        self.menu_button = button.Button(image=IMAGES["menu_button"],
                                         x=40,
                                         y=40)
        self.menu_button.command = lambda: messenger.Messenger.change_mode(
Beispiel #5
0
import pyglet
import config
import messenger
import random
import screen
from utility import list_pj, load_join_m, load_join_i
from pyglet.gl import * #Neccesary to prevent linear scaling

#Non-divided sprite_sheet
SPRITE_SHEET_MERGED = load_join_i(["resources", "art", "sprite_sheet.png"])

#Divided sprite_sheet
SPRITE_SHEET_DIVIDED = pyglet.image.ImageGrid(SPRITE_SHEET_MERGED, 8, 8) 

IMAGES = {} #A hash of all the images in the game with the appropriate names

PLAYER_IMAGES = [SPRITE_SHEET_DIVIDED[63],
                 SPRITE_SHEET_DIVIDED[62]]

PRESENT_IMAGES = [SPRITE_SHEET_DIVIDED[56],
                  SPRITE_SHEET_DIVIDED[57],
                  SPRITE_SHEET_DIVIDED[58]]

SOUNDS = dict(zip(["beep", "end", "crumple"],
                  map(lambda x: pyglet.media.load(list_pj(x), streaming=False), 
                      [["resources", "music", "bell-ring-01.mp3"],
                       ["resources", "music", "bell-ringing-01.mp3"],
                       ["resources", "music", "paper-rustle-8.mp3"]])))

BACKGROUND_IMAGES = map(load_join_i,
                        [["resources", "art", "background1.png"],
Beispiel #6
0
import pyglet
import screen
import button
import messenger
import config
import text
from utility import load_join_i

IMAGES = {}
IMAGES["background"] = load_join_i(["resources", "art", "background1.png"])
IMAGES["menu_button"] = load_join_i(["resources", "art", "menu_button.png"])


class CreditScreen(screen.AbstractScreen):
    def __init__(self):
        messenger.Messenger.creditScreen = self
        self.font_size = 40
        self.color = (0, 0, 0, 255)
        self.background = IMAGES["background"]
        self.make_buttons()
        self.make_labels()

    def on_draw(self):
        self.background.blit(0, 0)
        self.menu_button.draw()
        self.score_label.draw()
        self.score_comment.draw()

    def make_score_comment(self):
        score = messenger.Messenger.gameScreen.score
        if score == 0: