Inheritance: Microsoft.Xna.Framework.Game
コード例 #1
0
        protected PlayerSprite(
            MonoGameQuest game,
            string spriteSheetName,
            int pixelWidth,
            int pixelHeight,
            int pixelOffsetX,
            int pixelOffsetY,
            Vector2 coordinatePosition)
            : base(game,
                game.Content.Load<Texture2D>(string.Concat(@"images\", spriteSheetName)),
                pixelWidth, 
                pixelHeight,
                pixelOffsetX, 
                pixelOffsetY)
        {
            PixelHeight = pixelHeight;
            PixelWidth = pixelWidth;
            PixelOffsetX = pixelOffsetX;
            PixelOffsetY = pixelOffsetY;
            CoordinatePosition = coordinatePosition;

            DrawOrder = Constants.DrawOrder.Sprites;
            UpdateOrder = Constants.UpdateOrder.Sprites;

            _animations = new Dictionary<Tuple<AnimationType, Direction>, PlayerSpriteAnimation>();

            // update the pixel position for the starting coordinate position:
            TranslateCoordinatePositionToPixelPosition();
        }
コード例 #2
0
        public PathfindingBox(MonoGameQuest game)
            : base(game)
        {
            _sprite = new Sprite(
                game,
                game.Content.Load<Texture2D>("images/target"),
                16,
                16,
                0,
                0);

            _sprite.CurrentAnimation = new Animation(
                _sprite.SpriteSheet,
                0,
                16,
                16,
                4,
                50);

            _sprite.BlendState = BlendState.NonPremultiplied;
            _sprite.DrawOrder = Constants.DrawOrder.CursorBox;
            _sprite.Enabled = false;
            _sprite.SamplerState = SamplerState.PointClamp;
            _sprite.UpdateOrder = Constants.UpdateOrder.Cursor;
            _sprite.Visible = false;

            game.Components.Add(_sprite);

            UpdateOrder = Constants.UpdateOrder.Cursor;
        }
コード例 #3
0
ファイル: Display.cs プロジェクト: half-ogre/MonoGameQuest
        public Display(MonoGameQuest game)
            : base(game)
        {
            Scale = 1;
            UpdateOrder = Constants.UpdateOrder.Display;

            UpdateScale(Game.GraphicsDevice.PresentationParameters);
        }
コード例 #4
0
ファイル: Cursor.cs プロジェクト: half-ogre/MonoGameQuest
        public Cursor(MonoGameQuest game)
            : base(game)
        {
            DrawOrder = Constants.DrawOrder.CursorBox;
            UpdateOrder = Constants.UpdateOrder.Cursor;

            _sprite = new Hand(game);
            Game.Components.Add(_sprite);
        }
コード例 #5
0
ファイル: Player.cs プロジェクト: half-ogre/MonoGameQuest
        public Player(MonoGameQuest game)
            : base(game)
        {
            _movement = new Stack<Action>();
            _pathfinder = new Pathfinder();

            Orientation = Direction.Down;
            Path = new Queue<Vector2>();
            UpdateOrder = Constants.UpdateOrder.Models;
        }
コード例 #6
0
ファイル: Hand.cs プロジェクト: half-ogre/MonoGameQuest
 public Hand(MonoGameQuest game)
     : base(game: game,
         spriteSheet: game.Content.Load<Texture2D>("images/hand"),
         pixelWidth: 14,
         pixelHeight: 14)
 {
     CurrentAnimation = new Animation(
         spriteSheet: SpriteSheet,
         spriteSheetRow: 0,
         framePixelWidth: 14,
         framePixelHeight: 14,
         framesLength: 1);
 }
コード例 #7
0
 public CursorSprite(
     MonoGameQuest game,
     Texture2D spriteSheet,
     int pixelWidth,
     int pixelHeight)
     : base(game: game, 
         spriteSheet: spriteSheet, 
         pixelWidth: pixelWidth, 
         pixelHeight: pixelHeight, 
         pixelOffsetX: 0, 
         pixelOffsetY: 0)
 {
     DrawOrder = Constants.DrawOrder.Cursor;
     UpdateOrder = Constants.UpdateOrder.Sprites;
 }
コード例 #8
0
ファイル: Map.cs プロジェクト: half-ogre/MonoGameQuest
        public Map(MonoGameQuest game)
            : base(game)
        {
            var tmxMap = new TmxMap(@"Content\map\map.tmx");

            CoordinateHeight = tmxMap.Height;
            CoordinateWidth = tmxMap.Width;

            CoordinateTerminus = new Vector2(
                CoordinateWidth - 1f,
                CoordinateHeight - 1f);

            PixelTileHeight = tmxMap.TileHeight;
            PixelTileWidth = tmxMap.TileWidth;

            _locations = new Dictionary<Vector2, List<int>>();

            foreach (var layer in tmxMap.Layers)
            {
                if (!layer.Visible || layer.Name.Equals("entities", StringComparison.OrdinalIgnoreCase))
                    continue;

                foreach (var tile in layer.Tiles)
                {
                    if (tile.Gid > 0)
                    {
                        var position = new Vector2(tile.X, tile.Y);

                        if (!_locations.ContainsKey(position))
                            _locations.Add(position, new List<int>());

                        _locations[position].Add(tile.Gid);
                    }
                }
            }

            BackgroundColor = new Color(
                r: tmxMap.BackgroundColor.R,
                g: tmxMap.BackgroundColor.G,
                b: tmxMap.BackgroundColor.R);
            UpdateOrder = Constants.UpdateOrder.Map;
        }
コード例 #9
0
ファイル: ClothArmor.cs プロジェクト: half-ogre/MonoGameQuest
        public ClothArmor(MonoGameQuest game, Vector2 coordinatePosition)
            : base(game: game, 
            spriteSheetName: "clotharmor",
            pixelWidth: 32, 
            pixelHeight: 32, 
            pixelOffsetX: -8, 
            pixelOffsetY: -12, 
            coordinatePosition: coordinatePosition)
        {
            AddAnimation(
                AnimationType.Idle,
                Direction.Up,
                spriteSheetRow: 5,
                framesLength: 2,
                frameDuration: Constants.DefaultIdleSpeed);

            AddAnimation(
                AnimationType.Idle,
                Direction.Down,
                spriteSheetRow: 8,
                framesLength: 2,
                frameDuration: Constants.DefaultIdleSpeed);

            AddAnimation(
                AnimationType.Idle,
                Direction.Left,
                spriteSheetRow: 2,
                framesLength: 2,
                frameDuration: Constants.DefaultIdleSpeed,
                flipHorizontally: true);

            AddAnimation(
                AnimationType.Idle,
                Direction.Right,
                spriteSheetRow: 2,
                framesLength: 2,
                frameDuration: Constants.DefaultIdleSpeed);

            AddAnimation(
                AnimationType.Walk,
                Direction.Up,
                spriteSheetRow: 4,
                framesLength: 4,
                frameDuration: Constants.DefaultWalkSpeed);

            AddAnimation(
                AnimationType.Walk,
                Direction.Down,
                spriteSheetRow: 7,
                framesLength: 4,
                frameDuration: Constants.DefaultWalkSpeed);

            AddAnimation(
                AnimationType.Walk,
                Direction.Left,
                spriteSheetRow: 1,
                framesLength: 4,
                frameDuration: Constants.DefaultWalkSpeed,
                flipHorizontally: true);

            AddAnimation(
                AnimationType.Walk,
                Direction.Right,
                spriteSheetRow: 1,
                framesLength: 4,
                frameDuration: Constants.DefaultWalkSpeed);
        }
コード例 #10
0
 protected MonoGameQuestComponent(MonoGameQuest game)
     : base(game)
 {
 }
コード例 #11
0
 protected MonoGameQuestDrawableComponent(MonoGameQuest game)
     : base(game)
 {
 }
コード例 #12
0
ファイル: Terrain.cs プロジェクト: half-ogre/MonoGameQuest
 public Terrain(MonoGameQuest game)
     : base(game)
 {
     DrawOrder = Constants.DrawOrder.Terrain;
     UpdateOrder = Constants.UpdateOrder.Terrain;
 }
コード例 #13
0
ファイル: DebugInfo.cs プロジェクト: half-ogre/MonoGameQuest
 public DebugInfo(MonoGameQuest game)
     : base(game)
 {
     DrawOrder = Constants.DrawOrder.Debug;
     UpdateOrder = Constants.UpdateOrder.Debug;
 }
コード例 #14
0
ファイル: Program.cs プロジェクト: half-ogre/MonoGameQuest
 static void Main()
 {
     using (var game = new MonoGameQuest())
         game.Run();
 }