forked from CaptainCarmel/python-pygame-platformer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplatformer.py
More file actions
95 lines (75 loc) · 2.66 KB
/
platformer.py
File metadata and controls
95 lines (75 loc) · 2.66 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Dinosaur player images by Arks
# https://arks.itch.io/dino-characters
# Twitter: @ScissorMarks
# Coin sprite by DasBilligeAlien
# https://opengameart.org/content/rotating-coin-0
# Enemy sprite by bevouliin.com
# https://opengameart.org/content/bevouliin-free-ingame-items-spike-monsters
# Heart sprite by Nicole Marie T
# https://opengameart.org/content/heart-1616
# Music by ArcOfDream
# https://arcofdream.itch.io/monolith-ost
# Sound by Maskedsound
# https://maskedsound.itch.io/8-bit-sfx-pack
import pygame
import engine
import utils
import level
import scene
import globals
import inputstream
import soundmanager
# constant variables
SCREEN_SIZE = (830,830)
DARK_GREY = (50,50,50)
MUSTARD = (209,206,25)
# init
pygame.init()
screen = pygame.display.set_mode(SCREEN_SIZE)
pygame.display.set_caption('Rik\'s Platform Game')
clock = pygame.time.Clock()
sceneManager = scene.SceneManager()
mainMenu = scene.MainMenuScene()
sceneManager.push(mainMenu)
inputStream = inputstream.InputStream()
# create player
globals.player1 = utils.makePlayer(300,0)
#globals.player1.camera = engine.Camera(10,10,400,400)
#globals.player1.camera.setWorldPos(300,0)
#globals.player1.camera.trackEntity(globals.player1)
globals.player1.input = engine.Input(pygame.K_w, pygame.K_s, pygame.K_a, pygame.K_d, pygame.K_q, pygame.K_e)
# create player
globals.player2 = utils.makePlayer(350,0)
#globals.player2.camera = engine.Camera(420,10,400,400)
#globals.player2.camera.setWorldPos(350,0)
#globals.player2.camera.trackEntity(globals.player2)
globals.player2.input = engine.Input(pygame.K_i, pygame.K_k, pygame.K_j, pygame.K_l, pygame.K_u, pygame.K_o)
# create player
globals.player3 = utils.makePlayer(400,0)
#globals.player3.camera = engine.Camera(10,420,400,400)
#globals.player3.camera.setWorldPos(400,0)
#globals.player3.camera.trackEntity(globals.player3)
globals.player3.input = engine.Input(pygame.K_z, pygame.K_z, pygame.K_z, pygame.K_z, pygame.K_z, pygame.K_x)
# create player
globals.player4 = utils.makePlayer(450,0)
#globals.player4.camera = engine.Camera(420,420,400,400)
#globals.player4.camera.setWorldPos(450,0)
#globals.player4.camera.trackEntity(globals.player4)
globals.player4.input = engine.Input(pygame.K_z, pygame.K_z, pygame.K_z, pygame.K_z, pygame.K_z, pygame.K_x)
running = True
while running:
# game loop
# check for quit
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
inputStream.processInput()
globals.soundManager.update()
if sceneManager.isEmpty():
running = False
sceneManager.input(inputStream)
sceneManager.update(inputStream)
sceneManager.draw(screen)
clock.tick(60)
# quit
pygame.quit()