Пример #1
0
 public Layer(Map map)
 {
     Map = map;
     Rows = map.Rows;
     Cols = map.Cols;
     Tiles = new Tile[Rows, Cols];
 }
Пример #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            GameService.AddService(Content);
            GameService.AddService(Window);
            GameService.AddService(graphics);
            GameService.AddService(spriteBatch);


            /*  layer.Tiles = new Tile[2, 2];

            layer.Tiles[0, 0] = new Tile(0, 0, 0, 0, 0);
            layer.Tiles[0, 1] = new Tile(0, 0, 1, 16, 0);
            layer.Tiles[1, 0] = new Tile(0, 1, 0, 0, 16);
            layer.Tiles[1, 1] = new Tile(0, 1, 1, 16, 16);*/


            /*map = new Map("hu3", 2, 2);
            var layer = new Layer(map);
            var tileset = new Tileset(0, Content.Load<Texture2D>("t1"));
            tileset.Name = "oi";
            map.AddTileset(tileset);

            layer.Tiles = new Tile[2, 2];

            layer.Tiles[0, 0] = new Tile(0, 0, 0, 0, 0);
            layer.Tiles[0, 1] = new Tile(0, 0, 1, 16, 0);
            layer.Tiles[1, 0] = new Tile(0, 1, 0, 0, 16);
            layer.Tiles[1, 1] = new Tile(0, 1, 1, 16, 16);

            map.AddLayer(layer);

            Serializer.Serialize<Map>("map/map.pks", map);
            */
            map = Serializer.Deserialize<Map>("map/map.pks", GraphicsDevice);


             animator = new Animator(Content.Load<Texture2D>("1"), new Vector2(50, 50));
            Animation animation = new Animation("teste", 5);
            animation.AddKeyFrame(8, 37, 16, 19);
            animation.AddKeyFrame(25, 36, 15, 19);
            animation.AddKeyFrame(41, 37, 15, 19);
            animator.AddAnimation(animation);
            animation = new Animation("stop", 1);
            animation.AddKeyFrame(8, 37, 16, 19);
            animator.AddAnimation(animation);
            animator.Play("stop");     
            hud = new HUD(this, Content, GraphicsDevice);
            ThreadAction.Factory(ScriptManager.Instance.Load, false);
            ThreadAction.Factory(ConsoleThread, 1, true); 
        }