def __init__(self, window, playerscore): window.preload_gamescene() pyglet.gl.glClearColor(1.0, 1.0, 1.0, 1.0) # Store a reference to the application window self.window = window self.splash_batch = pyglet.graphics.Batch() self.label_group = pyglet.graphics.OrderedGroup(1) self.bg_group = pyglet.graphics.OrderedGroup(0) self.done = False self.splash_images = [] scorebg = SplashImage(img('score.png'), self.splash_batch, self.bg_group, 300, 300, 0, 320, -1, 90 ) self.splash_images.append(scorebg) scoretext = SplashImage(img('scoretext.png'), self.splash_batch, self.label_group, 300, 450, 0, 320, -1, 90 ) self.splash_images.append(scoretext) self.score_labels = [] self.playerscore = playerscore self.lastscore = 0 self.lastscore_label = pyglet.text.Label('0', font_name='Psychotic', font_size=62, anchor_x = 'center', anchor_y = 'center', batch=self.splash_batch, group=self.label_group, x = 300, y=425 ) highscore_file = pyglet.resource.file('highscores.pkl', mode='r') self.highscores = pickle.load(highscore_file) self.highscores.append(playerscore) self.highscores.sort() self.highscores = self.highscores[1:] self.highscore_labels = self._get_highscore_labels() highscore_file = pyglet.resource.file('highscores.pkl', mode='w') pickle.dump(self.highscores, highscore_file) self.score_done = False self.score_labels.append(self.lastscore_label)
def __init__(self, window, playerscore): window.preload_gamescene() pyglet.gl.glClearColor(1.0, 1.0, 1.0, 1.0) # Store a reference to the application window self.window = window self.splash_batch = pyglet.graphics.Batch() self.label_group = pyglet.graphics.OrderedGroup(1) self.bg_group = pyglet.graphics.OrderedGroup(0) self.done = False self.splash_images = [] scorebg = SplashImage(img('score.png'), self.splash_batch, self.bg_group, 300, 300, 0, 320, -1, 90) self.splash_images.append(scorebg) scoretext = SplashImage(img('scoretext.png'), self.splash_batch, self.label_group, 300, 450, 0, 320, -1, 90) self.splash_images.append(scoretext) self.score_labels = [] self.playerscore = playerscore self.lastscore = 0 self.lastscore_label = pyglet.text.Label('0', font_name='Psychotic', font_size=62, anchor_x='center', anchor_y='center', batch=self.splash_batch, group=self.label_group, x=300, y=425) highscore_file = pyglet.resource.file('highscores.pkl', mode='r') self.highscores = pickle.load(highscore_file) self.highscores.append(playerscore) self.highscores.sort() self.highscores = self.highscores[1:] self.highscore_labels = self._get_highscore_labels() highscore_file = pyglet.resource.file('highscores.pkl', mode='w') pickle.dump(self.highscores, highscore_file) self.score_done = False self.score_labels.append(self.lastscore_label)
def __init__(self, window): # Store a reference to the application window pyglet.gl.glClearColor(0.133, 0.133, 0.133, 1.0) self.window = window self.splash_batch = pyglet.graphics.Batch() self.label_group = pyglet.graphics.OrderedGroup(1) self.bg_group = pyglet.graphics.OrderedGroup(0) rnd = random.Random(time.time()) self.blobs = [] self.blob_groups = [] self.player_blob_group = src.glsl.blob.BlobGroup( 300, -800, 8, (0.125, 0.375, 0.0)) self.player_blob = PlayerController(self, self.player_blob_group, 300, 300, True) self.blobs.append(self.player_blob) self.done = False self.splash_images = [] splashbg = SplashImage(img('splashbg.png'), self.splash_batch, self.bg_group, 300, 300, 0, 60, 5, 90) self.splash_images.append(splashbg) splasha = SplashImage(img('splash_a.png'), self.splash_batch, self.label_group, 300, 388, 2, 230, 2, 170) self.splash_images.append(splasha) splashname = SplashImage(img('splash_pyweeklings.png'), self.splash_batch, self.label_group, 300, 300, 3, 120, 4, 170) self.splash_images.append(splashname) splashgame = SplashImage(img('splash_game.png'), self.splash_batch, self.label_group, 300, 221, 4, 230, 2, 170) self.splash_images.append(splashgame) babaroa = SplashImage( img('dempa.png'), self.splash_batch, self.bg_group, 300, 300, 9, 80, -1, 0, maxopacity=128, ) self.splash_images.append(babaroa) self.logo = SplashImage(img('logo.png'), self.splash_batch, self.label_group, 300, 300, 9, 80, -1, 90) self.splash_images.append(self.logo) multipliers = [0.0, 0.3, 0.8] for i in xrange(9): for j in xrange(5 + (i * 2 / 3)): r = b = random.choice(multipliers[:-1]) g = min(1.0, r + random.choice(multipliers[1:])) column = rnd.randint(10, 590) blob_group = src.glsl.blob.BlobGroup( column, rnd.randint(-100 * (i + 1), -100 * i), 8, (r, g, b)) self.blob_groups.append(blob_group) newblob = PlayerController(self, blob_group, column, 610) self.blobs.append(newblob) self.doblobs = False pyglet.clock.schedule_once(self._set_do_blobs, 4.0) if config.options['USE_SOUND']: self.intro_player = pyglet.media.Player() self.intro_sound = pyglet.media.load('dat/audio/1creepy.mp3', streaming=False) self.intro_player.queue(self.intro_sound) self.intro_player.volume = 0.1 self.intro_player.play()
def __init__(self, window): # Store a reference to the application window pyglet.gl.glClearColor(0.133, 0.133, 0.133, 1.0) self.window = window self.splash_batch = pyglet.graphics.Batch() self.label_group = pyglet.graphics.OrderedGroup(1) self.bg_group = pyglet.graphics.OrderedGroup(0) rnd = random.Random(time.time()) self.blobs = [] self.blob_groups = [] self.player_blob_group = src.glsl.blob.BlobGroup(300, -800, 8, (0.125, 0.375, 0.0)) self.player_blob = PlayerController(self, self.player_blob_group, 300, 300, True) self.blobs.append(self.player_blob) self.done = False self.splash_images = [] splashbg = SplashImage(img('splashbg.png'), self.splash_batch, self.bg_group, 300, 300, 0, 60, 5, 90 ) self.splash_images.append(splashbg) splasha = SplashImage(img('splash_a.png'), self.splash_batch, self.label_group, 300, 388, 2, 230, 2, 170 ) self.splash_images.append(splasha) splashname = SplashImage(img('splash_pyweeklings.png'), self.splash_batch, self.label_group, 300, 300, 3, 120, 4, 170 ) self.splash_images.append(splashname) splashgame = SplashImage(img('splash_game.png'), self.splash_batch, self.label_group, 300, 221, 4, 230, 2, 170 ) self.splash_images.append(splashgame) babaroa = SplashImage(img('dempa.png'), self.splash_batch, self.bg_group, 300, 300, 9, 80, -1, 0, maxopacity=128, ) self.splash_images.append(babaroa) self.logo = SplashImage(img('logo.png'), self.splash_batch, self.label_group, 300, 300, 9, 80, -1, 90 ) self.splash_images.append(self.logo) multipliers = [0.0, 0.3, 0.8] for i in xrange(9): for j in xrange(5 + (i * 2 / 3)): r = b = random.choice(multipliers[:-1]) g = min(1.0, r + random.choice(multipliers[1:])) column = rnd.randint(10, 590) blob_group = src.glsl.blob.BlobGroup( column, rnd.randint(-100 * (i + 1), -100 * i), 8, (r, g, b) ) self.blob_groups.append(blob_group) newblob = PlayerController(self, blob_group, column, 610) self.blobs.append(newblob) self.doblobs = False pyglet.clock.schedule_once(self._set_do_blobs, 4.0) if config.options['USE_SOUND']: self.intro_player = pyglet.media.Player() self.intro_sound = pyglet.media.load('dat/audio/1creepy.mp3', streaming=False) self.intro_player.queue(self.intro_sound) self.intro_player.volume = 0.1 self.intro_player.play()