-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrow.py
More file actions
58 lines (47 loc) · 1.13 KB
/
arrow.py
File metadata and controls
58 lines (47 loc) · 1.13 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
from Rectangle import *
from texture import *
def keypress(key, x, y):
global man_path,left_key,right_key
""" moving ball to the left"""
if G.squirrel.left > 0 and key == GLUT_KEY_LEFT:
G.ball_dir_x = -1
G.keystates[0] = True
G.keystates[1] = False
G.stand_left=True
if G.increaseR:
G.factor=1
G.increaseR=False
# """ moving ball to the right"""
elif G.squirrel.right < 800 and key == GLUT_KEY_RIGHT:
G.ball_dir_x = 1
G.keystates[0] = False
G.keystates[1] = True
if not G.increaseR :
G.factor=1
G.stand_left=False
G.increaseR=True
# """ jumping """
elif key == GLUT_KEY_UP:
if G.first_jump:
G.keystates[2] = True
G.jumping = True
elif G.on_plate:
G.keystates[2] = True
G.jumping = True
G.on_plate=False
# """ BEGIN"""
elif key == b' ' and G.gamestart is False:
G.gamestart = True
G.gameover = False
glutPostRedisplay()
def reset_keys(key,x,y):
if key == GLUT_KEY_LEFT:
G.index=6
G.keystates[0]=False
if key == GLUT_KEY_RIGHT:
G.index=7
G.keystates[1]=False
G.increaseR = False
if key == GLUT_KEY_UP:
G.keystates[2]=False
glutPostRedisplay() # to redraw the scene