Example #1
0
        public Player()
            : base()
        {
            Position = new Vector2(150, 120);
            playerTex = TextureManager.PlayerSheet2;

            velocity = new Vector2(0, 0);
            maxSpeed = 3f;
            acceleration = 0.1f;
            friction = 0.95f;
            gravity = 0.4f;
            jumpPower = 6.0f;

            isOnGround = false;

            colorArray = new Color[playerTex.Width * playerTex.Height];
            TextureManager.PlayerColTex.GetData(colorArray);

            colRange = 7;
            CollisionList = new List<Rectangle>();

            FrameWidth = 22;
            FrameHeight = 60;

            animator = new Animator(FrameWidth, FrameHeight);
            animator.AddAnimation(new Animation("right", 100, 0, 0, 8, 0, true));
            animator.AddAnimation(new Animation("left", 100, 0, 1, 8, 1, true));
            animator.AddAnimation(new Animation("jump", 200, 0, 2, 3, 2, false));
        }
Example #2
0
        public AnimatedTile(int aXIndex, int aYIndex, Texture2D aSpriteSheet, int aStartCol, int aStartRow, int aEndCol, int aEndRow, int aTimePerFrame = 100)
        {
            myPosition = new Vector2(aXIndex * MapManager.TileSize, aYIndex * MapManager.TileSize);
            mySpriteSheet = aSpriteSheet;

            myStartCol = aStartCol;
            myStartRow = aStartRow;
            myEndCol = aEndCol;
            myEndRow = aEndRow;

            myTimePerFrame = aTimePerFrame;

            myAnimator = new Animator(20, 20);
            myAnimator.AddAnimation(new Animation("animation", myTimePerFrame, myStartCol, myStartRow, myEndCol, myEndRow, true));
            myAnimator.StartAnimation("animation");
        }