コード例 #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];
        }
コード例 #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");
 }
コード例 #3
0
ファイル: Collider.cs プロジェクト: UnhappyDogChew/ChessRPG
        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.");
        }
コード例 #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);
 }
コード例 #5
0
ファイル: Boundary.cs プロジェクト: UnhappyDogChew/ChessRPG
 public Boundary(int x, int y) : base(x, y)
 {
     collider = new SquareCollider(x, y, 100, 50, 50, 25, true);
     player   = Global.world.GetPlayer();
 }