Ignore:
Files:
4 added
17 edited

Legend:

Unmodified
Added
Removed
  • data/levels/alientunnel1

    r582 r605  
    100100  name: keycard_yellow
    101101lines: []
    102 music: POL-cyber-factory-short.ogg
     102music: POL-future-war-short.ogg
    103103polygons:
    104104  1:
  • data/levels/alientunnel2

    r582 r605  
    8282- - [1100, 800]
    8383  - [1100, 400]
    84 music: POL-cyber-factory-short.ogg
     84music: POL-future-war-short.ogg
    8585polygons:
    8686  1:
  • data/levels/alientunnel3

    r582 r605  
    7171  name: acid_3_2
    7272lines: []
    73 music: POL-cyber-factory-short.ogg
     73music: POL-future-war-short.ogg
    7474polygons:
    7575  1:
  • data/levels/cargo_bay

    r616 r617  
    123123  classname: Note
    124124lines: []
    125 music: POL-cyber-factory-short.ogg
     125music: POL-tekdrome-short.ogg
    126126polygons:
    127127  1:
  • data/levels/crew

    r616 r617  
    126126  classname: ChargingAlien
    127127  name: room_two_alien
     128- args:
     129  - [2816, 1344]
     130  - 300
     131  classname: ChargingAlien
     132  name: lift_alien_1
     133- args:
     134  - [2648, 1336]
     135  - 300
     136  classname: ChargingAlien
     137  name: lift_alien_2
     138- args:
     139  - [2728, 1528]
     140  - 300
     141  classname: ChargingAlien
     142  name: lift_alien_3
    128143game_objects:
    129144- args:
     
    212227  classname: Door
    213228  name: room_one_exit
     229- args:
     230  - [440, 572]
     231  classname: collectable.Gun
     232  name: gun
    214233- args:
    215234  - [982, 671]
     
    361380  - [1760, 1265]
    362381  - -45
    363   classname: Door
     382  - hangar_door_puzzle
     383  classname: PuzzleDoor
    364384  name: to_hangar
     385- args: [lift_switch_1, lift_switch_2]
     386  classname: puzzle.StateLogicalAndPuzzler
     387  name: hangar_door_puzzle
     388- args:
     389  - [2900, 1576]
     390  classname: FloorSwitch
     391  name: lift_switch_1
     392- args:
     393  - [2556, 1220]
     394  classname: FloorSwitch
     395  name: lift_switch_2
    365396- args:
    366397  - [2596, 2248]
     
    447478  name: lift_box_3
    448479lines: []
    449 music: POL-cyber-factory-short.ogg
     480music: POL-against-the-system-short.ogg
    450481polygons:
    451482  1:
  • data/levels/finale

    r587 r608  
    4242  classname: AcidFloor
    4343  name: acid_4
    44 lines: []
     44- args:
     45  - [1900, 1700]
     46  - sensor_1
     47  classname: FloorLight
     48  name: light_1
     49- args:
     50  - [1700, 1900]
     51  - sensor_2
     52  classname: FloorLight
     53  name: light_2
     54- args:
     55  - [700, 2100]
     56  - end
     57  - [100, 100]
     58  - 135
     59  - keycard_cyan
     60  classname: KeyedDoor
     61  name: exit
     62- args:
     63  - [950, 1850]
     64  - finale
     65  - [900, 1900]
     66  - 135
     67  - keycard_magenta
     68  classname: KeyedDoor
     69  name: pre_exit
     70- args:
     71  - [1200, 1600]
     72  - finale
     73  - [1150, 1650]
     74  - 135
     75  - keycard_yellow
     76  classname: KeyedDoor
     77  name: pre_pre_exit
     78- args:
     79  - [1900, 1400]
     80  classname: FloorSwitch
     81  name: sensor_2
     82- args:
     83  - [1400, 900]
     84  classname: FloorSwitch
     85  name: sensor_1
     86- args: [sensor_1, sensor_2]
     87  classname: puzzle.StateLogicalAndPuzzler
     88  name: both_sensors
     89- args:
     90  - [1800, 1900]
     91  - [1900, 1800]
     92  - both_sensors
     93  classname: Hatch
     94  name: finale_hatch
     95- args:
     96  - [2000, 2000]
     97  classname: ToggleSwitch
     98  name: finale_toggle
     99- args:
     100  - [900, 1000]
     101  - [1000, 900]
     102  - finale_toggle
     103  classname: Hatch
     104  name: finale_magenta_hatch
     105- args:
     106  - [800, 800]
     107  - keycard_magenta
     108  classname: collectable.KeyCard
     109  name: keycard_magenta
     110lines:
     111- - [1100, 1500]
     112  - [500, 1900]
     113- - [1300, 1700]
     114  - [900, 2300]
     115- - [1300, 1700]
     116  - [1100, 1500]
     117- - [1100, 2000]
     118  - [800, 1700]
     119- - [1900, 2300]
     120  - [1700, 2000]
     121- - [2000, 1700]
     122  - [2300, 1900]
     123- - [1800, 1900]
     124  - [1700, 2000]
     125- - [2000, 1700]
     126  - [1900, 1800]
     127- - [800, 1100]
     128  - [500, 900]
     129- - [1100, 800]
     130  - [900, 500]
     131- - [900, 1000]
     132  - [800, 1100]
     133- - [1100, 800]
     134  - [1000, 900]
    45135music: moonlight-sonata.ogg
     136music_volume: 1.0
    46137polygons:
    47138  1:
  • data/levels/sheep

    r582 r605  
    8181- - [650, 500]
    8282  - [650, 600]
    83 music: POL-cyber-factory-short.ogg
     83music: POL-tunnels-short.ogg
    8484polygons:
    8585  1:
  • data/music/SOURCES.txt

    r306 r605  
    2121
    2222
     23POL-against-the-system-short.ogg
     24--------------------------------
     25
     26URL:
     27    http://www.backgroundmusicloops.net/free-music-loops/POL-against-the-system-short.zip
     28Source:
     29    http://www.playonloop.com/2011-music-loops/against-the-system/
     30License:
     31    http://creativecommons.org/licenses/by/3.0/
     32Credit:
     33    This royalty-free music loop is filed under the Heavy Rock > Rock
     34    category, tagged as Action, Aggressive, Evolving, Powerful and is
     35    ready for instant download! You can use this background music loop
     36    in any kind of production such as Video, Game, Flash, Website,
     37    Slideshow, Presentation, Mobile App, Radio, TV, and much more!
     38Notes:
     39    Ogg generated using 'oggenc -q -1 POL-against-the-system-short.wav'
     40
     41
     42POL-tekdrome-short.ogg
     43----------------------
     44
     45URL:
     46    http://www.backgroundmusicloops.net/free-music-loops/POL-tekdrome-short.zip
     47Source:
     48    http://www.playonloop.com/2012-music-loops/tekdrome/
     49License:
     50    http://creativecommons.org/licenses/by/3.0/
     51Credit:
     52    This royalty-free music loop is filed under the Dance > Electronic
     53    category, tagged as Action, Driving, Hi-tech, Powerful and is
     54    ready for instant download! You can use this background music loop
     55    in any kind of production such as Video, Game, Flash, Website,
     56    Slideshow, Presentation, Mobile App, Radio, TV, and much more!
     57Notes:
     58    Ogg generated using 'oggenc -q -1 POL-tekdrome-short.wav'
     59
     60
     61POL-future-war-short.ogg
     62------------------------
     63
     64URL:
     65    http://www.backgroundmusicloops.net/free-music-loops/POL-future-war-short.zip
     66Source:
     67    http://www.playonloop.com/2010-music-loops/future-war/
     68License:
     69    http://creativecommons.org/licenses/by/3.0/
     70Credit:
     71    This royalty-free music loop is filed under the Electronic >
     72    Psychedelic category, tagged as Action, Dark and is ready for
     73    instant download! You can use this background music loop in any
     74    kind of production such as Video, Game, Flash, Website, Slideshow,
     75    Presentation, Mobile App, Radio, TV, and much more!
     76Notes:
     77    Ogg generated using 'oggenc -q -1 POL-future-war-short.wav'
     78
     79
     80POL-tunnels-short.ogg
     81---------------------
     82
     83URL:
     84    http://www.backgroundmusicloops.net/free-music-loops/POL-tunnels-short.zip
     85Source:
     86    http://www.playonloop.com/2010-music-loops/tunnels/
     87License:
     88    http://creativecommons.org/licenses/by/3.0/
     89Credit:
     90    This royalty-free music loop is filed under the 8 Bit > Videogame
     91    category, tagged as Action, Driving and is ready for instant
     92    download! You can use this background music loop in any kind of
     93    production such as Video, Game, Flash, Website, Slideshow,
     94    Presentation, Mobile App, Radio, TV, and much more!
     95Notes:
     96    Ogg generated using 'oggenc POL-tunnels-short.wav'
     97
     98
    2399moonlight-sonata.ogg
    24100--------------------
  • nagslang/collectable.py

    r536 r601  
    5858        )
    5959
     60    @classmethod
     61    def requires(cls):
     62        return [("name", "string"), ("position", "coordinates")]
     63
    6064
    6165class KeyCard(CollectibleGameObject):
  • nagslang/constants.py

    r454 r607  
    2020CHANNELS = 2   # 1 == mono, 2 == stereo
    2121BUFFER = 1024  # audio buffer size in no. of samples
     22DEFAULT_SOUND_VOLUME = 1.0  # sound volume
     23DEFAULT_MUSIC_VOLUME = 0.3  # music volume
    2224
    2325COLLISION_TYPE_OTHER = 0
     
    6163PROTAGONIST_HEALTH_MIN_LEVEL = 0
    6264
    63 BULLET_DAMAGE = 10
     65BULLET_DAMAGE = 25
    6466CLAW_DAMAGE = 5
    6567ACID_DAMAGE = 7
  • nagslang/enemies.py

    r554 r603  
    1111from nagslang.game_object import (GameObject, SingleShapePhysicser, Result,
    1212                                  Bullet, make_body)
     13from nagslang.collectable import KeyCard
    1314from nagslang.mutators import FLIP_H
    1415from nagslang.resources import resources
     
    335336        result = super(Queen, self).update(dt)
    336337        self.spawn(result)
     338        if self.health <= 0:
     339            result.add += (KeyCard(self.get_space(),
     340            self.physicser.position, "keycard_cyan"),)
    337341        return result
    338342
     
    354358    def make_physics(self, space, position):
    355359        body = make_body(10, pymunk.inf, position, 0.8)
    356         shape = pymunk.Circle(body, 30)
     360        shape = pymunk.Circle(body, 20)
    357361        shape.elasticity = 1.0
    358362        shape.friction = 0.05
  • nagslang/game_object.py

    r591 r609  
    77from nagslang import puzzle
    88from nagslang import render
    9 from nagslang.mutators import FLIP_H, ImageOverlay, rotator
     9from nagslang.mutators import FLIP_H, ImageOverlay, rotator, scaler
    1010from nagslang.constants import (
    1111    COLLISION_TYPE_DOOR, COLLISION_TYPE_FURNITURE, COLLISION_TYPE_PROJECTILE,
     
    509509
    510510    def __init__(self, space, end1, end2, key_state=None):
    511         body = make_body(None, None, (0, 0))
    512         self.shape = pymunk.Segment(body, tuple(end1), tuple(end2), 7)
     511        a = pymunk.Vec2d(end1)
     512        b = pymunk.Vec2d(end2)
     513        offset = b - a
     514        offset.length /= 2
     515        mid = (a + offset).int_tuple
     516        body = make_body(None, None, mid)
     517        self.shape = pymunk.Segment(
     518            body, body.world_to_local(tuple(end1)),
     519            body.world_to_local(tuple(end2)), 7)
    513520        self.shape.collision_type = COLLISION_TYPE_DOOR
    514521        if key_state is None:
     
    535542                ("end2", "coordinates"), ("key_state", "puzzler")]
    536543
    537     # The level knows that bulkheads are magical
     544    # The level knows that hatches are magical
     545    @classmethod
     546    def movable(cls):
     547        return True
     548
     549
     550class KeyedHatch(GameObject):
     551    zorder = ZORDER_FLOOR
     552
     553    def __init__(self, space, end1, end2, key_item):
     554        a = pymunk.Vec2d(end1)
     555        b = pymunk.Vec2d(end2)
     556        offset = b - a
     557        offset.length /= 2
     558        mid = (a + offset).int_tuple
     559        body = make_body(None, None, mid)
     560        self.shape = pymunk.Segment(
     561            body, body.world_to_local(tuple(end1)),
     562            body.world_to_local(tuple(end2)), 7)
     563        self.shape.collision_type = COLLISION_TYPE_DOOR
     564        self._key_item = key_item
     565        super(KeyedHatch, self).__init__(
     566            SingleShapePhysicser(space, self.shape),
     567            render.KeyedHatchRenderer(
     568                resources.get_image(
     569                    'objects', '%s.png' % (key_item,),
     570                    transforms=(scaler((32, 32)),))),
     571            puzzle.ParentAttrPuzzler('is_open'),
     572        )
     573        self.add_timer('door_open', 0.1)
     574
     575    @property
     576    def is_open(self):
     577        return self.check_timer('door_open')
     578
     579    def collide_with_protagonist(self, protagonist):
     580        if protagonist.has_item(self._key_item):
     581            self.start_timer('door_open')
     582            return False
     583        return True
     584
     585    @classmethod
     586    def requires(cls):
     587        return [("name", "string"), ("end1", "coordinates"),
     588                ("end2", "coordinates"), ("key_item", "item name")]
     589
     590    # The level knows that hatches are magical
    538591    @classmethod
    539592    def movable(cls):
  • nagslang/level.py

    r582 r608  
    1313from nagslang.resources import resources
    1414from nagslang.yamlish import load, dump
     15from nagslang.constants import DEFAULT_MUSIC_VOLUME
    1516
    1617POLY_COLORS = {
     
    4344        self.basetile = 'tiles/floor.png'
    4445        self.music = None
     46        self.music_volume = None
    4547        self._tile_image = None
    4648        self._surface = None
     
    6668            'lines': self.lines,
    6769            'music': self.music,
     70            'music_volume': self.music_volume,
    6871            'game_objects': self._game_objects,
    6972            'enemies': self._enemies,
     
    9598        self.basetile = data['base_tile']
    9699        self.music = data['music']
     100        self.music_volume = data.get('music_volume', DEFAULT_MUSIC_VOLUME)
    97101        for i, points in data['polygons'].iteritems():
    98102            self.polygons[i] = []
  • nagslang/mutators.py

    r555 r604  
    1919        if not isinstance(other, Mutator):
    2020            return NotImplemented
    21         return (self._func is other._func) and (self._args == other._args)
     21        return (self._func == other._func) and (self._args == other._args)
    2222
    2323    def __repr__(self):
  • nagslang/render.py

    r558 r609  
    4848
    4949
    50 class HatchRenderer(Renderer):
     50class HatchRendererMixin(object):
    5151    def draw_hatch_line(self, surface, a, b):
    5252        ai, bi = extend_line(a, b, -2)
     
    5757            surface, pygame.color.THECOLORS['lightblue'], ai, bi, 5)
    5858
    59     def render(self, surface):
     59    def render_hatch(self, surface):
    6060        shape = self.game_object.get_shape()
     61        a = shape.body.local_to_world(shape.a)
     62        b = shape.body.local_to_world(shape.b)
    6163        if self.game_object.puzzler.get_state():
    62             offset = vec_from_angle((shape.b - shape.a).angle, 10)
    63             ai = shape.a + offset
    64             bi = shape.b - offset
    65             self.draw_hatch_line(surface, shape.a, ai)
    66             self.draw_hatch_line(surface, bi, shape.b)
    67         else:
    68             mid = shape.a + (shape.b - shape.a) / 2
    69             self.draw_hatch_line(surface, shape.a, mid)
    70             self.draw_hatch_line(surface, mid, shape.b)
     64            offset = vec_from_angle((b - a).angle, 10)
     65            ai = a + offset
     66            bi = b - offset
     67            self.draw_hatch_line(surface, a, ai)
     68            self.draw_hatch_line(surface, bi, b)
     69        else:
     70            mid = a + (b - a) / 2
     71            self.draw_hatch_line(surface, a, mid)
     72            self.draw_hatch_line(surface, mid, b)
     73
     74
     75class HatchRenderer(Renderer, HatchRendererMixin):
     76    def render(self, surface):
     77        self.render_hatch(surface)
    7178
    7279
     
    95102        self.render_image(surface, self.get_image())
    96103        super(ImageRenderer, self).render(surface)
     104
     105
     106class KeyedHatchRenderer(ImageRenderer, HatchRendererMixin):
     107    def render(self, surface):
     108        self.render_hatch(surface)
     109        if not self.game_object.puzzler.get_state():
     110            self.render_image(surface, self.get_image())
    97111
    98112
  • nagslang/screens/area.py

    r586 r608  
    9595        self.add_game_objects()
    9696        self.save_progress()
    97         sound.play_music(self._level.music)
     97        sound.play_music(self._level.music, self._level.music_volume)
    9898        self._background = None
    9999        self._surface = None
  • nagslang/sound.py

    r591 r598  
    55from nagslang.options import options
    66from nagslang.resources import resources
    7 from nagslang.constants import FREQ, BITSIZE, CHANNELS, BUFFER
     7from nagslang.constants import (
     8    FREQ, BITSIZE, CHANNELS, BUFFER, DEFAULT_SOUND_VOLUME,
     9    DEFAULT_MUSIC_VOLUME)
    810
    911
     
    1214        pass
    1315
    14     def play_sound(self, name, volume=None):
     16    def play_sound(self, name, volume=DEFAULT_SOUND_VOLUME):
    1517        pass
    1618
    17     def play_music(self, name, volume=None):
     19    def play_music(self, name, volume=DEFAULT_MUSIC_VOLUME):
    1820        pass
    1921
     
    4345        return sound
    4446
    45     def play_sound(self, name, volume=1.0):
     47    def play_sound(self, name, volume=DEFAULT_SOUND_VOLUME):
    4648        sound = self.load_sound(name)
    4749        if sound is not None:
     
    4951            sound.play()
    5052
    51     def play_music(self, name, volume=1.0):
     53    def play_music(self, name, volume=DEFAULT_MUSIC_VOLUME):
    5254        if not options.music:
    5355            return
Note: See TracChangeset for help on using the changeset viewer.