Пример #1
0
        public Player(ContentManager cm, SpriteBatch sb, GraphicsDeviceManager gdm)
        {
            //configures the image sheet associated with the player
            playerImageSheet = new AnimatedImage(cm, sb, gdm.GraphicsDevice, "PlayerImages/PlayerPlaceholderRefined", new Vector2(1372, 469), new Vector2(18, 5));
            playerImageSheet.frameTimeLimit = 8;
            playerImageSheet.Initialize();
            playerImageSheet.setFrameConfiguration(0, 0, 1);
            //playerImageSheet.isAnimating = false;

            boundingRectangleColor = cm.Load<Texture2D>("CollisionColor");

            //sets the references to the spritebatch and content manager so this class can define items in the content pipeline and draw to the same area
            sbReference = sb;
            cmReference = cm;
            gdmReference = gdm;

            //environment variables
            previousWorldPosition = Vector2.Zero;
            currentWorldPosition = Vector2.Zero;
            velocity = new Vector2(8, 25);
            momentum = new Vector2(0,0);

            movingLeft = false;
            movingRight = false;
            movingUp = false;
            movingDown = false;

            standing = true;

            isJumping = false;
            isFalling = false;
            isFallingFromGravity = false;
            isDashing = false;
            exhaustedDash = false;

            jumpTimer = 0;
            jumpTimerMax = 20;

            dashTimer = 0;
            dashTimerMax = 10;

            currentActionHurdleReference = null;
            actionButtonBeingPressed = false;
            actionStateIsActive = false;
            hurdleActionStateActive = false;
            upTheHurdle = false;
            overTheHurdle = false;
            hurdleTimer = 0;
            hurdleTimerMax = 10;
            hurdleDistance = Vector2.Zero;

            facingLeft = false;
            facingRight = true;

            playerCollisionOccurred = false;
            collisionOnPlayerLeft = false;
            collisionOnPlayerRight = false;
            collisionOnPlayerTop = false;
            collisionOnPlayerBottom = false;
        }
        public TiledPlatform(ContentManager cm, SpriteBatch sb, GraphicsDeviceManager gdm, bool cOnLeft, bool cOnRight, bool cOnTop, bool cOnBottom)
        {
            //configures the image sheet associated with the player
            imageSheet = new AnimatedImage(cm, sb, gdm.GraphicsDevice, "Square", new Vector2(16, 16), new Vector2(1, 1));
            imageSheet.frameTimeLimit = 8;
            imageSheet.Initialize();
            imageSheet.setFrameConfiguration(0, 0, 0);
            //imageSheet.isAnimating = false;

            //sets the references to the spritebatch and content manager so this class can define items in the content pipeline and draw to the same area
            sbReference  = sb;
            cmReference  = cm;
            gdmReference = gdm;

            //environment variables
            position     = Vector2.Zero;
            platformSize = new Vector2(1, 1);

            //will multiply the player's velocity by the corresponding vectors
            terrainModifier = new Vector2(1.0f, 1.0f);

            movingLeft  = false;
            movingRight = false;
            movingUp    = false;
            movingDown  = false;

            collidableOnLeft   = cOnLeft;
            collidableOnRight  = cOnRight;
            collidableOnTop    = cOnTop;
            collidableOnBottom = cOnBottom;

            //equivilant of the player class is the boolean "standing", basically default state
            notMoving = true;

            //Pretty sure I won't need these and they'll be deprecated for the platform
            facingLeft  = false;
            facingRight = true;
        }