Ejemplo n.º 1
0
        public Player(int x, int y, Sprite sprite, Game1 g, ViewArea viewArea)
            : base(x, y, sprite)
        {
            startPosition = new Vector2(x, y);
            Position = new Vector2(x, y);
            game = g;

            heat = 30;

            velocity = Vector2.Zero;
            acceleration = Vector2.Zero;
            this.viewArea = viewArea;
            this.punchSprite = new Sprite(g.ConditionalLoadSprite("punch", "sprites/fireball"));
            this.SetupAnimationSprites();
        }
Ejemplo n.º 2
0
        public void ViewAreaUpdated(ViewArea area)
        {
            int w = destRect.Width;
            int h = destRect.Height;
            var OffsetV = area.Offset;
            frontSourceRect = new Rectangle(
                (int)(OffsetV.X * frontFactor),
                (int)(OffsetV.Y * frontFactor),
                w, h
            );

            backSourceRect = new Rectangle(
                (int)(OffsetV.X * backFactor),
                (int)(OffsetV.Y * backFactor),
                w, h
            );
        }
Ejemplo n.º 3
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()
        {
            gameState = GameState.START;

            //initialize input
            Input.Initialize();

            // TODO: Add your initialization logic here
            textures = new Dictionary<string, Texture2D>();

            viewArea = new ViewArea(mapWidth, mapHeight);

            base.Initialize();
        }