-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
76 lines (56 loc) · 1.76 KB
/
config.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
73
74
75
76
"""
Collects static data used by other parts of the program.
Tweaking these settings allows global changes.
"""
from os.path import join, abspath, dirname
import os
import sys
TITLE = 'Logic Game'
FS = True
SHOW_FPS = False
JS_DEADZONE = 0.3 # The absolute value of a joystick movement must be greater than this value to count
BG_COLOR = (0.2,0.2,0.21,1)
SCALE = 2 # Global scale for all layers
TILE_SIZE = (16,16) # Size of tiles in pixels. Could be set programmatically by other means
SIZE = (30,18) # Size of field in tiles
WIDTH, HEIGHT = tuple([a*b*SCALE for a,b in zip(TILE_SIZE, SIZE)]) # Size of window,
# scaled for tile size,
# field size, and scale
MAPS_DIR = 'Maps/'
IMAGES_DIR = 'Images/'
# Directory to find libraries needed by the game.
LIB_DIR = '../lib/'
# Add those libraries to the system path
LIB_DIR = abspath(join(dirname(abspath(__file__)), LIB_DIR))
for lib in os.listdir(LIB_DIR):
sys.path.append(abspath(join(LIB_DIR, lib)))
import pyglet
pyglet.resource.path.append(MAPS_DIR)
pyglet.resource.path.append(IMAGES_DIR)
pyglet.resource.reindex()
GRAVITY = 900.0 # pixels/s^2
PLAYER_1 = {
'index': 1,
'joystick':
{
'x': 'HORIZONTAL_1',
'y': ('VERTICAL_1', 'invert'),
14: 'JUMP',
},
'keyboard':
{
# Format:
# 'key': 'input-name'
# 'key' should be the symbol string according to
# pyglet. The keys assigned to the names UP, DOWN,
# LEFT, and RIGHT, will be automatically mapped to show
# up as VERTICAL and HORIZONTAL scalars.
('UP', 'DOWN'): 'VERTICAL_1',
('RIGHT', 'LEFT'): 'HORIZONTAL_1',
'SPACE': 'JUMP',
},
'general':
{
'invert_y': True,
}
}