-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspacerocks.py
72 lines (42 loc) · 1.92 KB
/
spacerocks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
Space Rocks a simple 'Asteroids' style space shooter
Credits:
Graphics credits:
Kenny - http://www.kenney.nl
Skorpio - https://opengameart.org/users/skorpio
LuminousDragonGames - https://opengameart.org/users/luminousdragongames
Audio credits:
Kenny - http://www.kenney.nl + https://opengameart.org/content/space-shooter-redux
Michael Kurinnoy - AstroMenace Artwork ver 1.2 Assets Copyright (c) 2006-2007 Michael Kurinnoy, Viewizard
(https://opengameart.org/content/space-battle-game-sounds-astromenace)
Fonts:
Kenny - http://www.kenney.nl + https://opengameart.org/content/space-shooter-redux
Assets used under Public Domain or Creative Commons License (http://tinyurl.com/2dkzmd)
"""
import os
import pygame
from gamelib import game
from scenes import level
class Spacerocks (game.Game):
WINDOW_TITLE = 'Space Rocks'
# TODO: Scale all game objects based on resolution
SCREEN_RESOLUTIONS = [(1920, 1080), (1280, 720), (854, 480)]
SCREEN_WIDTH = SCREEN_RESOLUTIONS[0][0]
SCREEN_HEIGHT = SCREEN_RESOLUTIONS[0][1]
SCREEN_RECT = pygame.Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)
FPS = 100
def __init__(self):
super().__init__(Spacerocks.SCREEN_WIDTH, Spacerocks.SCREEN_HEIGHT,
Spacerocks.WINDOW_TITLE, Spacerocks.FPS)
self.image_cache.load(self.get_assets_path('images'))
self.audio_cache.load(self.get_assets_path('sounds'))
self._scene = level.GameScene(self)
self.set_active_scene(self._scene)
def load_font(self, filename, size):
path = self.get_assets_path('fonts')
return pygame.font.Font(os.path.join(path, filename), size)
def on_quit(self):
return True
if __name__ == "__main__":
app = Spacerocks()
app.run()