-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlay.py
More file actions
45 lines (33 loc) · 1.16 KB
/
Play.py
File metadata and controls
45 lines (33 loc) · 1.16 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
import pygame
from Setting import *
from Mariko import *
vector = pygame.math.Vector2
class Play:
def __init__(self, App):
self.App = App
self.mariko = Mariko(App, 8, 26)
self.grid = self.App.grid
def Event(self):
for event in pygame.event.get():
if (event.type == pygame.QUIT):
self.App.running = False
if (event.type == pygame.KEYDOWN):
if (event.key == pygame.K_LEFT):
print("Move Left")
self.mariko.Move(WEST)
if (event.key == pygame.K_RIGHT):
print("Move Right")
self.mariko.Move(EAST)
if (event.key == pygame.K_DOWN):
print("Move Down")
self.mariko.Move(SOUTH)
if (event.key == pygame.K_UP):
print("Move Up")
self.mariko.Move(NORTH)
if (event.type == pygame.KEYUP):
self.mariko.Move(DEFAULT)
def Update(self):
self.mariko.Update()
def draw(self):
self.mariko.draw()
pygame.display.update()