Exemple #1
0
        public BitmapSprite(XNAGraph g, string assetName, int cellWidth, int cellHeight, int rowLength, Rectangle hotspot)
        {
            graph = g;

            tex = g.LoadImage(assetName);
            this.width = cellWidth;
            this.height = cellHeight;
            this.rowLength = rowLength;
            this.hotspot = hotspot;
        }
Exemple #2
0
    protected override void LoadContent()
    {
        graph = new XNAGraph(graphics.GraphicsDevice, this.Content);
        input = new InputHandler();

        tileset = new BitmapSprite(graph, "mantiles", 16, 16, 19, new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16));
        TabbySprite = new BitmapSprite(graph, "tabpis", 64, 64, 8, new Rectangle(24, 24, 16, 40));
        DoorSprite = new BitmapSprite(graph, "door", 16, 64, 7, new Rectangle(0, 0, 16, 64));
        RipperSprite = new BitmapSprite(graph, "ripper", 16, 32, 4, new Rectangle(0, 0, 16, 20));
        BoomSprite = new BitmapSprite(graph, "boom", 16, 16, 7, new Rectangle(0, 0, 16, 16));
        BulletSprite = new BitmapSprite(graph, "bullet", 8, 8, 8, new Rectangle(0, 0, 8, 8));

        player = new Player(this);
        cameraTarget = player;
        player.X = player.Y = 32;	// arbitrary, if the map doesn't stipulate a starting point.

        obstructionTiles = new ObstructionTileset();

        MapSwitch("tiledtest.tmx");

        obstructionLayer = null;
        foreach (var l in map.Layers) {
            string value;
            var s = l.Value.Properties.TryGetValue("type", out value);
            if (s && value == "obstructions") {
                obstructionLayer = l.Value;
                obstructionTiles.Layer = obstructionLayer;
                //obstructionLayer.Opacity = 0;
                break;
            }
        }

        time = new Timer(100);
    }