Exemplo n.º 1
0
        public Item(Spritesheet spritesheet, Vector2 position, Rectangle sourceRectangle, bool putInBag) : base(spritesheet, position)
        {
            spritesheet.SetFrameCount(new Point(1, 1));
            spritesheet.Interval = 100;

            if (putInBag == true)
            {
                Pickup();
            }
            else
            {
                isInBag = false;
            }

            dragMode = false;
        }
Exemplo n.º 2
0
        public Inventory(Spritesheet spritesheet, Vector2 position) : base(spritesheet, position)
        {
            spritesheet.SetFrameCount(new Point(5, 1));
            spritesheet.Interval = 100;

            pixelMain.SetData(colorDataSadBrown);
            pixelLayer1.SetData(colorDataDGray);
            pixelInvTile.SetData(colorDataBlack);
            IsActive   = false;
            DragMode   = false;
            Opacity    = 0.8f;
            rectMain   = new Rectangle(Game1.ScreenWidth - invMainWidth - invMainMarginX, invMainMarginY, invMainWidth, Game1.ScreenHeight - invMainMarginY * 2);
            rectLayer1 = new Rectangle(rectMain.X + invLayer1MarginX, rectMain.Y + invLayer1MarginY, rectMain.Width - invLayer1MarginX * 2, rectMain.Height - invLayer1MarginY * 2);

            Instance = this;
            CreateTiles();
        }
Exemplo n.º 3
0
        public Player(Spritesheet spritesheet, Vector2 position, Vector2 groundPositionOffset, Vector2 depthSortingOffset, Stats stats, Map map, Grid grid, Player player) : base(spritesheet, position, groundPositionOffset, depthSortingOffset, stats, map, grid, player)
        {
            attackRange = 150;

            light            = new PointLight();
            light.Scale      = new Vector2(1000, 1500).ToCartesian();
            light.Intensity  = 1f;
            light.ShadowType = ShadowType.Solid;
            GameManager.Instance.Penumbra.Lights.Add(light);
            Scale        = 3;
            speed        = 200f;
            LayerDepth   = 0.2f;
            bottomHitBox = new FloatRectangle(new Vector2(Position.X, Position.Y + (int)(spritesheet.SourceRectangle.Height * 0.90 * Scale)),
                                              new Vector2(spritesheet.SourceRectangle.Width * Scale, (spritesheet.SourceRectangle.Height * Scale) / 10));

            OverhealDegradeInterval = 300f;
            CanFireBall             = 0;
            spritesheet.SetFrameCount(new Point(5, 1));
            spritesheet.Interval = 100;
            hpBar = new HealthBar(stats.MaxHealth, 0.6f /*new Vector2(200, 25)*/, new Vector2(50, 50));
        }
Exemplo n.º 4
0
        public void Animation()
        {
            if (currentPlayerState != PlayerState.Idle && currentPlayerState != PlayerState.Attacking)
            {
                switch (facingDirection)
                {
                case FacingDirection.North:
                    Spritesheet.SetFrameCount(new Point(5, 5));
                    Spritesheet.SetCurrentFrame(20);
                    break;

                case FacingDirection.NorthEast:
                    Spritesheet.SetFrameCount(new Point(5, 9));
                    Spritesheet.SetCurrentFrame(40);
                    break;

                case FacingDirection.East:
                    Spritesheet.SetFrameCount(new Point(5, 3));
                    Spritesheet.SetCurrentFrame(10);
                    break;

                case FacingDirection.SouthEast:
                    Spritesheet.SetFrameCount(new Point(5, 6));
                    Spritesheet.SetCurrentFrame(25);
                    break;

                case FacingDirection.South:
                    Spritesheet.SetFrameCount(new Point(5, 4));
                    Spritesheet.SetCurrentFrame(15);
                    break;

                case FacingDirection.SouthWest:
                    Spritesheet.SetFrameCount(new Point(5, 7));
                    Spritesheet.SetCurrentFrame(30);
                    break;

                case FacingDirection.West:
                    Spritesheet.SetFrameCount(new Point(5, 2));
                    Spritesheet.SetCurrentFrame(5);
                    break;

                case FacingDirection.NorthWest:
                    Spritesheet.SetFrameCount(new Point(5, 8));
                    Spritesheet.SetCurrentFrame(35);
                    break;
                }
            }
            else if (currentPlayerState == PlayerState.Idle && !playAttackAnimation)
            {
                Spritesheet.SetFrameCount(new Point(5, 1));
                Spritesheet.SetCurrentFrame(0);
            }

            if (playAttackAnimation)
            {
                Spritesheet.SetFrameCount(new Point(5, 10));
                Spritesheet.SetCurrentFrame(45);
                Spritesheet.Interval = 50;

                if (Spritesheet.CurrentFrame >= 49)
                {
                    playAttackAnimation = false;
                }
            }

            if (!playAttackAnimation)
            {
                Spritesheet.Interval = 100;
            }
        }