~rick-rickspencer3/pygame-template/trunk

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
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2010 Rick Spencer <rick.spencer@canonical.com>
#This program is free software: you can redistribute it and/or modify it 
#under the terms of the GNU General Public License version 3, as published 
#by the Free Software Foundation.
#
#This program is distributed in the hope that it will be useful, but 
#WITHOUT ANY WARRANTY; without even the implied warranties of 
#MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program.  If not, see <http://www.gnu.org/licenses/>.
### END LICENSE

# THIS IS crashteroids CONFIGURATION FILE
# YOU CAN PUT THERE SOME GLOBAL VALUE
# Do not touch until you know what you're doing.
# you're warned :)

# where your project will head for your data (for instance, images and ui files)
# by default, this is ../data, relative your trunk layout
__crashteroids_data_directory__ = '../data/'


import os

class project_path_not_found(Exception):
    pass

def getdatapath():
    """Retrieve crashteroids data path

    This path is by default <crashteroids_lib_path>/../data/ in trunk
    and /usr/share/crashteroids in an installed version but this path
    is specified at installation time.
    """

    # get pathname absolute or relative
    if __crashteroids_data_directory__.startswith('/'):
        pathname = __crashteroids_data_directory__
    else:
        pathname = os.path.dirname(__file__) + '/' + __crashteroids_data_directory__

    abs_data_path = os.path.abspath(pathname)
    if os.path.exists(abs_data_path):
        return abs_data_path
    else:
        raise project_path_not_found


image_path = os.path.join(getdatapath(), "media/")
sound_path = os.path.join(getdatapath(), "media/")

background_image = image_path + "background.png"
game_over_background = image_path + "game_over.png"

#player
guy_img = image_path + "guy.png"
guy_bullet = image_path + "bullet.png"
bullet_explode_stage = image_path + "bullet_explode_"
guy_explode_stage = image_path + "guy_explode_"
enemy_explode_stage = image_path + "guy_explode_"
enemy_image = image_path + "enemy.png"
homing_missle_image = image_path + "homing_missle.png"

guy_eng = sound_path + "engine_hum.wav"
guy_explode = sound_path + "explosion.wav"
guy_shoot_sound = sound_path + "blam.wav"
guy_bullet_explode = sound_path + "explosion.wav"
free_guy_sound = sound_path + "free_guy.wav"
#enemies
enemy_explode_sound = sound_path + "explosion.wav"