-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmario.py
35 lines (26 loc) · 878 Bytes
/
mario.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
# coding: utf-8
from pymlgame.surface import Surface
from pymlgame.locals import RED, BLUE
class Mario:
def __init__(self):
self.normal = Surface(2, 4)
self.normal.draw_line((0, 0), (1, 0), RED)
self.normal.draw_dot((0, 1), (127, 0, 0))
self.normal.draw_dot((1, 1), (255, 127, 0))
self.normal.draw_dot((0, 2), RED)
self.normal.draw_dot((1, 2), BLUE)
self.normal.draw_line((0, 3), (1, 3), BLUE)
self.current = self.normal
self.x = 2
self.y = 8
self.width = self.current.width
self.height = self.current.height
self.direction = 1 # 0: left, 1: right
self.jumping = False
self.moving = False
def render(self):
"""
Return current form of mario.
:returns: Surface - Marios surface
"""
return self.current