Exemple #1
0
 //public Imp(string texture, Vector2 position, Rectangle sourceRectangle, Vector2 depthSortingOffset, Player player, Grid grid, Map map, int hp, int attack, int defense) :
 //{
 //    attackSize = 500;
 //    aggroRange = 1200;
 //    speed = 160f;
 //    attacking = false;
 //    Color = Color.Red;
 //}
 public Imp(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 = 500;
     aggroRange  = 600;
     speed       = 160f;
     isAttacking = false;
     Color       = Color.Red;
 }
Exemple #2
0
        public PhysicsObject(Spritesheet spritesheet, Vector2 position, Vector2 direction, float speed) : base(spritesheet, position)
        {
            Direction = direction;
            Speed     = speed;

            Direction = Vector2.Normalize(Direction);

            Console.WriteLine(Direction);
        }
Exemple #3
0
 public Creature(Spritesheet spritesheet, Vector2 position, Vector2 groundPositionOffset, Vector2 depthSortingOffset, Stats stats, Map map, Grid grid, Player player) : base(spritesheet, position, depthSortingOffset, true)
 {
     Stats  = stats;
     Map    = map;
     Grid   = grid;
     Player = player;
     this.groundPositionOffset = groundPositionOffset;
     attackHitbox   = new FloatRectangle(new Vector2(), new Vector2(attackRange, attackRange));
     GroundPosition = Position + Center + groundPositionOffset;
 }
Exemple #4
0
        public Enemy(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)
        {
            Scale      = 0.1f;
            LayerDepth = 0.2f;
            path       = new Position[0];

            //Det behövdes en offset för att attacken skulle bli lika stor åt alla håll.
            offsetAttackPosition = new Vector2(-spritesheet.SourceRectangle.Width * Scale / (float)4, -spritesheet.SourceRectangle.Height * Scale / (float)4);
            //Ska flyttas.
        }
Exemple #5
0
        public Particle(Spritesheet spritesheet, Vector2 position, Vector2 direction, float speed, float fadeSpeed, Color color, float rotation = 0, float scale = 1) :
            base(spritesheet, position, direction, speed)
        {
            FadeSpeed = fadeSpeed;
            Color     = color;
            Rotation  = rotation;
            Scale     = scale;

            LayerDepth = 1f;
        }
Exemple #6
0
        public Equipment(Spritesheet spritesheet, Vector2 position, Rectangle sourceRectangle, bool putInBag, GearType gearType) : base(spritesheet, position, sourceRectangle, putInBag)
        {
            currentGearType      = gearType;
            verticalTileSlotSize = 1;
            texItem      = ResourceManager.Get <Texture2D>("rectangle");
            rectItemDrop = new Rectangle((int)position.X, (int)position.Y, 48, 48);

            switch (currentGearType)
            {
            case GearType.Sword:
                itemName        = "Wooden Sword";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(24, 120, 24, 24);
                break;

            case GearType.Shield:
                itemName        = "Wooden Shield";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(240, 120, 24, 24);
                break;

            case GearType.Helmet:
                itemName        = "Wooden Helmet";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(240, 264, 24, 24);
                break;

            case GearType.Ring:
                itemName        = "Wooden Leggings";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(24, 168, 24, 24);
                break;

            case GearType.Boots:
                itemName        = "Wooden Boots";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(24, 48, 24, 24);
                break;

            case GearType.Bodyarmor:
                itemName        = "Wooden Bracers";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(24, 48, 24, 24);
                break;

            case GearType.Gloves:
                itemName        = "Wool Bracers";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(24, 48, 24, 24);
                break;

            default:
                break;
            }
        }
Exemple #7
0
        public GameObject(Spritesheet spritesheet, Vector2 position)
        {
            Spritesheet = spritesheet;
            Position    = position;

            Transparency = 1f;
            Scale        = 1f;
            IsActive     = true;

            Color  = Color.White;
            Hitbox = new FloatRectangle(Position, new Vector2(spritesheet.SourceRectangle.Width * Scale, spritesheet.SourceRectangle.Height * Scale));
            Center = new Vector2((float)spritesheet.SourceRectangle.Width / 2 * Scale, (float)spritesheet.SourceRectangle.Height / 2 * Scale);
        }
Exemple #8
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;
        }
Exemple #9
0
        public Potion(Spritesheet spritesheet, Vector2 position, Rectangle sourceRectangle, bool putInBag, PotionType potionType) : base(spritesheet, position, sourceRectangle, putInBag)
        {
            texItem = ResourceManager.Get <Texture2D>("potionSheet");
            verticalTileSlotSize = 1;
            currentPotionType    = potionType;
            rectItemDrop         = new Rectangle((int)position.X, (int)position.Y, 48, 48);

            switch (currentPotionType)
            {
            case PotionType.HealthSmall:
                itemName         = "Potion of Minor Health";
                itemDescription  = "Heals the player 20 points of health.";
                sourceRectSprite = new Rectangle(24, 120, 24, 24);
                break;

            case PotionType.HealthMedium:
                itemName         = "Potion of Moderate Health";
                itemDescription  = "Heals the player 40 points of health.";
                sourceRectSprite = new Rectangle(240, 120, 24, 24);
                break;

            case PotionType.HealthLarge:
                itemName         = "Potion of Potent Health";
                itemDescription  = "Heals the player 80 points of health.";
                sourceRectSprite = new Rectangle(240, 264, 24, 24);
                break;

            case PotionType.SpeedPotion:
                itemName         = "Potion of Swiftness";
                itemDescription  = "Grants the player 2x walking\nspeed for 10 seconds.";
                sourceRectSprite = new Rectangle(24, 168, 24, 24);
                break;

            case PotionType.FireBall:
                itemName         = "Elixir of Fireball";
                itemDescription  = "Grants the player a single\nfireball charge to fire.";
                sourceRectSprite = new Rectangle(24, 48, 24, 24);
                break;

            default:
                break;
            }

            rectCurrentSprite = sourceRectSprite;
            rectFirstSprite   = sourceRectangle;
        }
Exemple #10
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();
        }
Exemple #11
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));
        }
Exemple #12
0
 public Projectile(Spritesheet spritesheet, Vector2 position, Vector2 direction, float speed) : base(spritesheet, position, direction, speed)
 {
     this.Direction = direction;
 }
Exemple #13
0
 public Treent(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 = 100;
     aggroRange  = 600;
     speed       = 100f;
 }
Exemple #14
0
 public Tile(TileType tileType, Spritesheet spritesheet)
 {
     TileType    = tileType;
     Spritesheet = spritesheet;
 }
Exemple #15
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;
            }
        }
Exemple #16
0
 public InventoryTile(Vector2 position, int tileSize, Texture2D pixel, Spritesheet texture) : base(texture, position)
 {
     this.pixel = pixel;
     rectangle  = new Rectangle((int)position.X, (int)position.Y, tileSize, tileSize);
 }