Changeset 59:1be1ca704346


Ignore:
Timestamp:
Apr 3, 2011, 8:02:19 PM (9 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Message:

Add Layers constants. Set Monsters to player's layer by default

Location:
skaapsteker
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/constants.py

    r38 r59  
    99
    1010DEBUG = True
     11
     12# Layer defination
     13class Layers(object):
     14    BACKGROUND = 0  # Absolute background
     15    BEHIND = 1  # Layer behind the player
     16    PLAYER = 2  # Layer of the player and enemies
     17    IN_FRONT = 3 # Layer in front of the player
     18    FOREGROUND = 4  # Absolute foreground
  • skaapsteker/physics.py

    r57 r59  
    88import pygame
    99import time
    10 from constants import DEBUG
     10from constants import DEBUG, Layers
    1111
    1212class Sprite(pygame.sprite.DirtySprite):
     
    2626        self.dirty = 1
    2727        self.blendmode = 0
     28        self._layer = Layers.BACKGROUND
    2829
    2930    def draw_debug(self, surface):
  • skaapsteker/sprites/base.py

    r47 r59  
    44
    55from skaapsteker.physics import Sprite
     6from skaapsteker.constants import Layers
    67from skaapsteker import data
    78
     
    1819        self.starting_tile_pos = pos
    1920        self.rect = self.image.get_rect(topleft=(pos[0]*TILE_SIZE[0], pos[1]*TILE_SIZE[1]))
     21        self._layer = Layers.PLAYER
    2022        self.setup(**opts)
    2123
  • skaapsteker/sprites/enemies.py

    r47 r59  
    11from base import Monster
    2 
    32
    43def get_enemy(enemydef):
     
    1312
    1413    def setup(self, direction):
    15         print "Dummy monster at %r, facing %s" % (self.starting_tile_pos, direction)
     14        print "Dummy monster at %r, facing %s on layer %s" % (self.starting_tile_pos, direction, self._layer)
    1615
    1716
Note: See TracChangeset for help on using the changeset viewer.