Exemple #1
0
        public Boss(TileMap tileMap, int tileIDGood, int tileIDGood2, int tileIDGood3, int tileIDGood4, int tileIDBad, int tileIDBad2, int tileIDBad3, int tileIDBad4)
            : base(tileMap, tileIDGood, tileIDBad)
        {
            IDGood2 = tileIDGood2;
            IDGood3 = tileIDGood3;
            IDGood4 = tileIDGood4;
            IDBad2 = tileIDBad2;
            IDBad3 = tileIDBad3;
            IDBad4 = tileIDBad4;
            this.Behaviours = new Dictionary<EntityState, List<Behaviour>>();

            this.Behaviours.Add(EntityState.GOOD,
                                new List<Behaviour>()
                                {
                                    new MoveToward(1, 500, true, true),
                                    new Deadly(),
                                    new Flies(false)
                                });
            this.Behaviours.Add(EntityState.BAD,
                                new List<Behaviour>()
                                {
                                    new Adhesive(),
                                    new MovePatrol(3,3,1)
                                });
            _width *= 4;
            _height *= 4;

            int[] gt = { _tileIDGood, IDGood2, IDGood3, IDGood4 };
            int[] bt = { _tileIDBad, IDBad2, IDBad3, IDBad4 };
            goodTiles = gt;
            badTiles = bt;
        }
Exemple #2
0
        public Bird_Block(TileMap tileMap, int tileIDGood, int tileIDBad, bool vert)
            : base(tileMap, tileIDGood, tileIDBad)
        {
            this.Behaviours = new Dictionary<EntityState, List<Behaviour>>();

            if (vert)
            {
                this.Behaviours.Add(EntityState.GOOD,
                                    new List<Behaviour>()
                                {
                                    new Deadly(),
                                    new Flies(true),
                                    new MovePatrolVert(30 * (int)Block.multToMatchBlock, 1 * (int)Block.multToMatchBlock)
                                });
            }
            else {
                                this.Behaviours.Add(EntityState.GOOD,
                                    new List<Behaviour>()
                                {
                                    new Deadly(),
                                    new Flies(true),
                                    new MovePatrol( (int)Block.multToMatchBlock * 30,(int)Block.multToMatchBlock * 30,(int)Block.multToMatchBlock * 1)
                                });
            }
            this.Behaviours.Add(EntityState.BAD,
                                new List<Behaviour>()
                                {
                                    new Inanimate(),
                                    new Harmless()
                                });
        }
 public CharacterLibrary(TileMap t, int width, int height)
 {
     w = width;
     h = height;
     tileMap = t;
     /*
      * Some test characters
      */
 }
Exemple #4
0
        int oldDirection = 0; // 1 for right, 0 for still, -1 for left

        #endregion Fields

        #region Constructors

        public Player(TileMap tileMap, int tileIDGood, int tileIDBad)
            : base(tileMap, tileIDGood, tileIDBad)
        {
            Animated = true;
            Behaviours = new Dictionary<EntityState, List<Behaviour>>();
            currentBehaviours = new List<Behaviour>();
            Behaviours[EntityState.GOOD] = currentBehaviours;
            Behaviours[EntityState.BAD] = currentBehaviours;
        }
Exemple #5
0
 public Worm_Devil(TileMap tileMap, int tileIDGood, int tileIDBad)
     : base(tileMap, tileIDGood, tileIDBad)
 {
     this.Behaviours = new Dictionary<EntityState, List<Behaviour>>();
     this.Behaviours.Add(EntityState.GOOD,
                         new List<Behaviour>()
                         {
                             new Harmless(),
                         });
     this.Behaviours.Add(EntityState.BAD,
                         new List<Behaviour>()
                         {
                             new Deadly(),
                             new MoveToward((int)Block.multToMatchBlock * 0.5,(int)Block.multToMatchBlock * 100,true,false),
                         });
 }
Exemple #6
0
        public Shrom_Man(TileMap tileMap, int tileIDGood, int tileIDBad)
            : base(tileMap, tileIDGood, tileIDBad)
        {
            this.Behaviours = new Dictionary<EntityState, List<Behaviour>>();

            this.Behaviours.Add(EntityState.GOOD,
                                new List<Behaviour>()
                                {
                                    new Harmless()
                                });
            this.Behaviours.Add(EntityState.BAD,
                                new List<Behaviour>()
                                {
                                    new MovePatrol((int)Block.multToMatchBlock * 3,(int)Block.multToMatchBlock * 3,(int)Block.multToMatchBlock * 0.5f),
                                    new Deadly()
                                });
        }
Exemple #7
0
        public Knight_Ghost(TileMap tileMap, int tileIDGood, int tileIDBad)
            : base(tileMap, tileIDGood, tileIDBad)
        {
            this.Behaviours = new Dictionary<EntityState, List<Behaviour>>();

            this.Behaviours.Add(EntityState.GOOD,
                                new List<Behaviour>()
                                {
                                    new MovePatrol((int)Block.multToMatchBlock * 3,(int)Block.multToMatchBlock * 3,(int)Block.multToMatchBlock * 1),
                                    new Deadly()
                                });
            this.Behaviours.Add(EntityState.BAD,
                                new List<Behaviour>()
                                {
                                    new MovePatrol((int)Block.multToMatchBlock * 3,(int)Block.multToMatchBlock * 3,(int)Block.multToMatchBlock * 1)
                                });
        }
Exemple #8
0
        public Snail_Bull(TileMap tileMap, int tileIDGood, int tileIDBad)
            : base(tileMap, tileIDGood, tileIDBad)
        {
            this.Behaviours = new Dictionary<EntityState, List<Behaviour>>();

            this.Behaviours.Add(EntityState.GOOD,
                                new List<Behaviour>()
                                {
                                    new Deadly(),
                                    new MovePatrol((int)Block.multToMatchBlock * 30,(int)Block.multToMatchBlock * 30, (int)Block.multToMatchBlock * 0.1f)
                                });
            this.Behaviours.Add(EntityState.BAD,
                                new List<Behaviour>()
                                {
                                    new Deadly(),
                                    new MoveToward((int)Block.multToMatchBlock * 2,(int)Block.multToMatchBlock * 200,true,false),
                                });
        }
Exemple #9
0
        public Door(TileMap tileMap, int tileIDGood, int tileIDBad)
            : base(tileMap, tileIDGood, tileIDBad)
        {
            this.Behaviours = new Dictionary<EntityState, List<Behaviour>>();

            this.Behaviours.Add(EntityState.GOOD,
                                new List<Behaviour>()
                                {
                                    new WinLevel(),
                                    new Inanimate()
                                });
            this.Behaviours.Add(EntityState.BAD,
                                new List<Behaviour>()
                                {
                                    new WinLevel(),
                                    new Inanimate()
                                });
        }
Exemple #10
0
 public Fly_Wasp(TileMap tileMap, int tileIDGood, int tileIDBad)
     : base(tileMap, tileIDGood, tileIDBad)
 {
     this.Behaviours = new Dictionary<EntityState, List<Behaviour>>();
     this.Behaviours.Add(EntityState.GOOD,
                         new List<Behaviour>()
                         {
                             new Harmless(),
                             new Flies(true),
                             new MovePatrol((int)Block.multToMatchBlock * 30,(int)Block.multToMatchBlock * 30,(int)Block.multToMatchBlock * 1)
                         });
     this.Behaviours.Add(EntityState.BAD,
                         new List<Behaviour>()
                         {
                             new Flies(true),
                             new Deadly(),
                             new MoveToward((int)Block.multToMatchBlock * 1.25,(int)Block.multToMatchBlock * 150,true,true),
                         });
 }
Exemple #11
0
 public NPC(TileMap tileMap, int tileIDGood, int tileIDBad)
     : base(tileMap, tileIDGood, tileIDBad)
 {
 }
Exemple #12
0
 public Block(TileMap tileMap, int tileIDGood, int tileIDBad)
     : base(tileMap, tileIDGood, tileIDBad)
 {
 }
Exemple #13
0
 public Character(TileMap tileMap, int tileIDGood, int tileIDBad)
     : base(tileMap, tileIDGood, tileIDBad)
 {
 }
Exemple #14
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            Bounds = GraphicsDevice.Viewport.Bounds;
            //LevelParser.ParseTextFile("test.level");

            ContentManager manager = new ContentManager(this.Services, "Content");
            splash = manager.Load<Texture2D>("splash");
            gameOver = manager.Load<Texture2D>("game_over_bg");
            _currentLevel = new Level(1);

            tileMap = LevelParser.ParseTileMap(this, "tilemap", 32);

            /*
             * Add Levels
             */

            levels = new List<RawLevel>();

            levels.Add(LevelParser.ParseTextFile("../../../../EpheremalContent/firstlevel.level"));
            levels.Add(LevelParser.ParseTextFile("../../../../EpheremalContent/secondlevel.level"));
            levels.Add(LevelParser.ParseTextFile("../../../../EpheremalContent/mario.level"));
            //levels.Add(LevelParser.ParseTextFile("../../../../EpheremalContent/georges.level"));
            levels.Add(LevelParser.ParseTextFile("../../../../EpheremalContent/matt2.level"));
            levels.Add(LevelParser.ParseTextFile("../../../../EpheremalContent/jump.level"));
            levels.Add(LevelParser.ParseTextFile("../../../../EpheremalContent/bounce.level"));
            levels.Add(LevelParser.ParseTextFile("../../../../EpheremalContent/boss.level"));
            loadedLevel = false;

            /*
             * Create Player
             */
            Player = new Player(tileMap, 557, 557);

            base.Initialize();
        }
Exemple #15
0
 public Entity(TileMap tileMap, int tileIDGood, int tileIDBad)
 {
     this._tileIDGood = tileIDGood;
     this._tileIDBad = tileIDBad;
     this._tileMap = tileMap;
 }
Exemple #16
0
        public Boolean LoadLevel(Engine game, RawLevel rawLevel, TileMap tileMap)
        {
            _blocks = new LinkedList<Block>();
            _characters = new LinkedList<Character>();
            _entities = new LinkedList<Entity>();
            _raw = rawLevel;

            CharacterLibrary characterLibrary = new CharacterLibrary(
                tileMap,
                tileMap.Width / tileMap.TileSize,
                tileMap.Height / tileMap.TileSize
            );

            TileLibrary tileLibrary = new TileLibrary(
                tileMap.Width / tileMap.TileSize ,
                tileMap.Height / tileMap.TileSize
            );

            for (int y = 0; y < rawLevel.height; y++)
            {
                for (int x = 0; x < rawLevel.width; x++)
                {

                    /*
                     * Check for blocks
                     */

                    int blockIDGood = rawLevel.State1[y * rawLevel.width + x];
                    int blockIDBad = rawLevel.State2[y * rawLevel.width + x];

                    Block b = new Block(tileMap, blockIDGood, blockIDBad) { GridX = x, GridY = y };

                    b.AssignBehaviour(
                        new Dictionary<EntityState, List<Behaviour>>() {
                                {EntityState.GOOD, tileLibrary.get(blockIDGood)},
                                {EntityState.BAD, tileLibrary.get(blockIDBad)}
                        });
                    _blocks.AddLast(b);

                    if (!(b.Behaviours[EntityState.GOOD].Count == 0 && b.Behaviours[EntityState.BAD].Count == 0))

                        _entities.AddLast(b);

                    /*
                     * Check for characters
                     */
                    int characterId = rawLevel.Characters[y * rawLevel.width + x];
                    if(characterId != 0){
                        Character c = characterLibrary.get(characterId);
                        c.PosX = x * Block.BLOCK_WIDTH;
                        c.PosY = y * Block.BLOCK_WIDTH;

                        if (c is Boss) Debug.WriteLine(c.PosX + " , " + c.PosY);

                        _characters.AddFirst(c);
                        _entities.AddFirst(c);
                    }

                 }
            }

            _characters.AddFirst(Engine.Player);
            _entities.AddFirst(Engine.Player);
            foreach (Entity e in _entities) e.SetLevel(this);

            return true;
        }