示例#1
0
文件: Entity.cs 项目: kg/XnaMannux
        protected float x = 0, y = 0; //!< Position

        #endregion Fields

        #region Constructors

        public Entity(Engine e, BitmapSprite s)
        {
            engine = e;
            sprite = s;

            width = sprite.HotSpot.Width;
            height = sprite.HotSpot.Height;

            UpdateState = DoNothing;	// avoid null references
        }
示例#2
0
文件: Engine.cs 项目: kg/XnaMannux
    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.

        map = v2Map.Load("map00.map");
        MapSwitch("data/maps/test.map");
        obs = new VectorObstructionMap(map.Obs);

        time = new Timer(100);

        editor = new Editor.Editor(this);
        editor.OnExit += StopEditor;
    }
示例#3
0
 public Enemy(Engine e, BitmapSprite s)
     : base(e, s)
 {
 }
示例#4
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);
    }