예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Player"/> class.
        /// </summary>
        /// <param name="atlas">The atlas.</param>
        public Player(AtlasInfo atlas)
        {
            _atlas = atlas;

            _firstFrame = _currentFrame = _atlas.RightMovingAnimationStartFrame;
            _lastFrame  = _atlas.RightMovingAnimationEndFrame;
            position    = new Vector2(350, 350);
            _YFloor     = position.Y;
            isOnGround  = true;
        }
예제 #2
0
        protected override void LoadContent()
        {
            // Load scroller background.
            _scrollingBG = new ScrollingBackground(Content.Load <Texture2D>("Textures/Backgrounds/RoadAndTrees1"),
                                                   Content.Load <Texture2D>("Textures/Backgrounds/RoadAndTrees2"));
            // Load character.
            Texture2D texture        = Content.Load <Texture2D>("Textures/Sprites/John_LowRes_2Rows");
            AtlasInfo characterAtlas = new AtlasInfo(texture, 4, 4, 8, 11, 4, 7, 5, 9);

            _player = new Player(characterAtlas);

            _sprites = new List <Sprite>();

            _sprites.Add(new SquishyBug(Content.Load <Texture2D>("Textures/Sprites/Turtle"), new Vector2(600, 385), .5f));
            _sprites.Add(new Box(Content.Load <Texture2D>("Textures/Sprites/Box"), new Vector2(700, 315), .5f));
            _sprites.Add(new SoftproDollar(Content.Load <Texture2D>("Textures/Sprites/Dollar"), new Vector2(800, 200), .1f));
        }