Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ChessRPGMac.Player"/> class.
        /// It must be called in <see cref="Game.LoadContent"/> method.
        /// </summary>
        /// <param name="x">The x coordinate.</param>
        /// <param name="y">The y coordinate.</param>
        private Player(int x, int y) : base(x, y)
        {
            grassWalk_soundEffect = Global.content.Load <SoundEffect>("SE_GrassWalk");

            // Get Sprites from SpriteBox.
            spritesNoLantern    = new Sprite[4];
            spritesNoLantern[0] = Global.spriteBox.Pick("PlayerNoLantern_Down");
            spritesNoLantern[1] = Global.spriteBox.Pick("PlayerNoLantern_Up");
            spritesNoLantern[2] = Global.spriteBox.Pick("PlayerNoLantern_Right");
            spritesNoLantern[3] = Global.spriteBox.Pick("PlayerNoLantern_Left");

            spritesWithLantern    = new Sprite[4];
            spritesWithLantern[0] = Global.spriteBox.Pick("PlayerWithLantern_Down");
            spritesWithLantern[1] = Global.spriteBox.Pick("PlayerWithLantern_Up");
            spritesWithLantern[2] = Global.spriteBox.Pick("PlayerWithLantern_Right");
            spritesWithLantern[3] = Global.spriteBox.Pick("PlayerWithLantern_Left");

            collider = new SquareCollider(x, y, COLLIDER_WIDTH, COLLIDER_HEIGTH, COLLIDER_WIDTH / 2, COLLIDER_HEIGTH / 2, true);

            heros          = new List <Hero>();
            items          = new Item[ITEM_HEIGHT, ITEM_WIDTH];
            HP             = maxHP;
            lanternEnergy  = 0;
            gold           = 0;
            alive          = true;
            direction      = 0;
            walking        = false;
            holdingLantern = false;
            moveSpeed      = 3;

            TeamSize = 3;

            currentSprite = spritesNoLantern[direction];
        }
Ejemplo n.º 2
0
 public EnemySoul(int x, int y, Combat combat) : base(x, y)
 {
     player              = Global.world.GetPlayer();
     this.combat         = combat;
     collider            = new SquareCollider(x, y, COLLIDER_WIDTH, COLLIDER_HEIGHT, COLLIDER_WIDTH / 2, COLLIDER_HEIGHT / 2);
     interactionCollider = new SquareCollider(x, y, COLLIDER_WIDTH + 10, COLLIDER_HEIGHT + 6,
                                              COLLIDER_WIDTH / 2 + 5, COLLIDER_HEIGHT / 2 + 3, false);
     sprite = Global.spriteBox.Pick("PlunckWithFlower");
 }
Ejemplo n.º 3
0
        public override bool Detect(Collider other)
        {
            if (other is SquareCollider)
            {
                SquareCollider sq = (SquareCollider)other;
                if (sq.bboxTop > this.bboxBottom || sq.bboxLeft > this.bboxRight ||
                    sq.bboxBottom < this.bboxTop || sq.bboxRight < this.bboxLeft)
                {
                    return(false);
                }
                return(true);
            }
            else if (other is NullCollider)
            {
                return(false);
            }

            throw new NotImplementedException("Not implemented collider.");
        }
Ejemplo n.º 4
0
 public Lantern(int x, int y) : base(x, y)
 {
     sprite              = Global.spriteBox.Pick("Lantern");
     collider            = new SquareCollider(x, y, 14, 7, 6, 3);
     interactionCollider = new SquareCollider(x, y, 18, 9, 8, 4, false);
 }
Ejemplo n.º 5
0
 public Boundary(int x, int y) : base(x, y)
 {
     collider = new SquareCollider(x, y, 100, 50, 50, 25, true);
     player   = Global.world.GetPlayer();
 }