brutalmaze/brutalmaze/constants.py

65 lines
2.4 KiB
Python
Raw Normal View History

2017-10-12 15:29:55 +02:00
# -*- coding: utf-8 -*-
# constants.py - module for shared constants
2017-10-12 15:29:55 +02:00
# This file is part of brutalmaze
#
# brutalmaze is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# brutalmaze is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with brutalmaze. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2017 Nguyễn Gia Phong
from pygame import image
from pkg_resources import resource_filename
__doc__ = 'brutalmaze module for shared constants'
ICON = image.load(resource_filename('brutalmaze', 'icon.png'))
2017-10-12 15:29:55 +02:00
SQRT2 = 2 ** 0.5
GOLDEN_MEAN = 5**0.5/2 + 0.5
2017-10-12 15:29:55 +02:00
2017-10-19 10:24:56 +02:00
INIT_FPS = 30.0
MAX_FPS = 144.0
2017-10-19 10:24:56 +02:00
SIZE = 640, 480
2017-10-19 15:28:56 +02:00
MAZE_SIZE = 10
ROAD_WIDTH = 5 # grids
CELL_WIDTH = ROAD_WIDTH * 2 # grids
MIDDLE = (MAZE_SIZE + MAZE_SIZE%2 - 1)*ROAD_WIDTH + ROAD_WIDTH//2
LAST_ROW = (MAZE_SIZE-1) * ROAD_WIDTH * 2
INIT_SCORE = 208.2016
2017-10-19 10:24:56 +02:00
MOVE_SPEED = 5 # grid/s
2017-10-21 16:22:06 +02:00
BULLET_SPEED = 10 # grid/s
HEAL_SPEED = 1 # HP/s
2017-10-21 16:22:06 +02:00
ATTACK_SPEED = 333 # ms/strike
BULLET_LIFETIME = 1000 # ms
EMPTY, WALL, HERO, ENEMY = range(4)
ADJACENT_GRIDS = (1, 0), (0, 1), (-1, 0), (0, -1)
SURROUND_HERO = set((MIDDLE + x, MIDDLE + y) for x, y in
ADJACENT_GRIDS + ((1, 1), (-1, 1), (-1, -1), (1, -1)))
2017-10-12 15:29:55 +02:00
TANGO = {'Butter': ((252, 233, 79), (237, 212, 0), (196, 160, 0)),
'Orange': ((252, 175, 62), (245, 121, 0), (206, 92, 0)),
'Chocolate': ((233, 185, 110), (193, 125, 17), (143, 89, 2)),
'Chameleon': ((138, 226, 52), (115, 210, 22), (78, 154, 6)),
'Sky Blue': ((114, 159, 207), (52, 101, 164), (32, 74, 135)),
'Plum': ((173, 127, 168), (117, 80, 123), (92, 53, 102)),
'Scarlet Red': ((239, 41, 41), (204, 0, 0), (164, 0, 0)),
'Aluminium': ((238, 238, 236), (211, 215, 207), (186, 189, 182),
(136, 138, 133), (85, 87, 83), (46, 52, 54))}
ENEMIES = ('Butter', 'Orange', 'Chocolate', 'Chameleon',
'Sky Blue', 'Plum', 'Scarlet Red')
ENEMY_HP = 3
HERO_HP = 6
2017-10-12 15:29:55 +02:00
BG_COLOR = TANGO['Aluminium'][-1]
FG_COLOR = TANGO['Aluminium'][0]