Changeset 362:d0aeb893967d


Ignore:
Timestamp:
Sep 6, 2013, 6:12:07 PM (7 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
rebase_source:
41485248bee508fdeed573b6a5051d139c39eb45
Message:

Transparent moonlight

Location:
nagslang
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nagslang/game_object.py

    r359 r362  
    1111    COLLISION_TYPE_DOOR, COLLISION_TYPE_FURNITURE, COLLISION_TYPE_PROJECTILE,
    1212    COLLISION_TYPE_SWITCH, COLLISION_TYPE_WEREWOLF_ATTACK,
    13     SWITCH_PUSHERS, ZORDER_FLOOR, ZORDER_LOW)
     13    SWITCH_PUSHERS, ZORDER_FLOOR, ZORDER_LOW, ZORDER_HIGH)
    1414from nagslang.resources import resources
    1515from nagslang.events import DoorEvent
     
    499499        body = make_body(1, pymunk.inf,
    500500                         (pos[0] + (vector.length * math.cos(vector.angle)),
    501                          pos[1] + (vector.length * math.sin(vector.angle))))
     501                          pos[1] + (vector.length * math.sin(vector.angle))))
    502502        body.angle = vector.angle
    503503        self.shape = pymunk.Circle(body, 30)
     
    523523    damage = None
    524524    tile = None
     525    tile_alpha = 255
    525526    # How often to hit the player
    526527    rate = 5
     
    538539            SingleShapePhysicser(space, self.shape),
    539540            render.TiledRenderer(outline,
    540                                  resources.get_image('tiles', self.tile)))
     541                                 resources.get_image('tiles', self.tile),
     542                                 self.tile_alpha))
    541543
    542544    def collide_with_protagonist(self, protagonist):
     
    568570    tile = 'moonlight.png'
    569571    rate = 0
     572    tile_alpha = 150
     573    zorder = ZORDER_HIGH
    570574
    571575    def apply_effect(self, protagonist):
  • nagslang/render.py

    r353 r362  
    194194       Outline is assumed to be in pymunk coordinates"""
    195195
    196     def __init__(self, outline, tile_image):
     196    def __init__(self, outline, tile_image, alpha=255):
    197197        self._tile_image = tile_image
    198198        self.outline = outline
    199199        self._tiled = None
    200200        self._offset = None
     201        self._alpha = alpha
    201202
    202203    def _make_surface(self, surface):
     
    207208            pointlist = [pymunk.pygame_util.to_pygame(p, surface)
    208209                         for p in self.outline]
    209             rect = pygame.draw.polygon(mask, pygame.color.THECOLORS['white'],
     210            rect = pygame.draw.polygon(mask,
     211                                       pygame.color.Color(
     212                                           255, 255, 255, self._alpha),
    210213                                       pointlist, 0)
    211214            self._offset = (rect.x, rect.y)
  • nagslang/utils.py

    r348 r362  
    2929
    3030
    31 def tile_surface(size, tile_image):
     31def tile_surface(size, tile_image, alpha=255):
    3232    # create a surface, approriately tiled
    3333    surface = pygame.surface.Surface(size, pgl.SRCALPHA)
    34     surface.fill(pygame.color.THECOLORS['black'])
     34    surface.fill(pygame.color.Color(0, 0, 0, alpha))
    3535    x_step = tile_image.get_rect().width
    3636    y_step = tile_image.get_rect().height
Note: See TracChangeset for help on using the changeset viewer.