Esempio n. 1
0
        public LevelMap( Player player, Enemy redEnemy, Texture2D image, Texture2D mask )
        {
            ActorObjects = new List<GameActor>( );
            Image = image;
            Mask = mask;

            ThePlayer = player;
            RedEnemy = redEnemy;

            MaskData = new Color[mask.Width * mask.Height];
            Mask.GetData<Color>( MaskData );
            CalculateSpawnPoints( );
            player.Position = SpawnPoint;

            Tint = Color.White;
        }
Esempio n. 2
0
        public Enemy( Enemy other )
            : base(other._game)
        {
            FacingDirection = other.FacingDirection;
            IsEnemy = true;

            if ( other.AttackEastAnim != null ) AttackEastAnim = new AnimatedSprite( other.AttackEastAnim );
            if ( other.AttackNorthAnim != null ) AttackNorthAnim = new AnimatedSprite( other.AttackNorthAnim );
            if ( other.AttackSouthAnim != null ) AttackSouthAnim = new AnimatedSprite( other.AttackSouthAnim );

            if ( other.WalkEastAnim != null ) WalkEastAnim = new AnimatedSprite( other.WalkEastAnim );
            if ( other.WalkNorthAnim != null ) WalkNorthAnim = new AnimatedSprite( other.WalkNorthAnim );
            if ( other.WalkSouthAnim != null ) WalkSouthAnim = new AnimatedSprite( other.WalkSouthAnim );

            if ( other.ProjectileEastAnim != null ) ProjectileEastAnim = new AnimatedSprite( other.ProjectileEastAnim );
            if ( other.ProjectileNorthAnim != null ) ProjectileNorthAnim = new AnimatedSprite( other.ProjectileNorthAnim );
            if ( other.ProjectileSouthAnim != null ) ProjectileSouthAnim = new AnimatedSprite( other.ProjectileSouthAnim );

            ReplaceCurrentAnimation( );
        }
Esempio n. 3
0
 protected void CalculateSpawnPoints( )
 {
     for ( int i = 0; i < MaskData.Length; ++i ) {
         if ( MaskData[i] == Color.Black ) {
             SpawnPoint = new Vector2( i % Mask.Width, i / Mask.Width );
         }
         else if ( MaskData[i] == Color.Red && RedEnemy != null ) {
             Enemy clone =  new Enemy( RedEnemy );
             clone.Position = new Vector2( i % Mask.Width, i / Mask.Width );
             ActorObjects.Add( clone );
         }
     }
 }