Exemple #1
0
        public Background(FlappyMagi game)
        {
            this._game = game;
            this._resourceManager = game.ResourceManager;

            this._dayTime = 0.0f;
            this._isDay = true;

            _texDay = _resourceManager.GetTexture("Back/day");
            _texNight = _resourceManager.GetTexture("Back/night");
            _texGround = _resourceManager.GetTexture("Back/ground");
            _texture1 = _texture2 = _texture3 = _texDay;

            this._x1 = 0;
            this._x2 = _texDay.Width;
            this._x3 = 2 * _texDay.Width;
        }
Exemple #2
0
        public PipeWave(FlappyMagi game)
        {
            this._game = game;
            this._resourceManager = game.ResourceManager;

            _texPipeTop = _resourceManager.GetTexture("Pipe/top");
            _texPipeBottom = _resourceManager.GetTexture("Pipe/bottom");

            int startX = _startX;
            for (int i = 0; i < 3; ++i)
            {
                var ys = SelectPipePos();
                float y1 = ys.Item1;
                float y2 = ys.Item2;

                Pipe pipeTop = new Pipe(new Vector2(startX + i * _pipeStride, y1), _texPipeTop);
                Pipe pipeBottom = new Pipe(new Vector2(startX + i * _pipeStride, y2), _texPipeBottom);
                _pipes.Enqueue(pipeTop);
                _pipes.Enqueue(pipeBottom);
            }
        }
Exemple #3
0
        public Magi(FlappyMagi game, Vector2 pos, Vector2 velocity)
        {
            this._game = game;
            this._resourceManager = game.ResourceManager;
            this._pos = pos;
            this._velocity = velocity;
            this._isDead = false;
            this._isOnGround = false;

            this._currentFrame = 0;
            this._time = 0.0f;

            _tex0 = new Texture2D[]
            {
                _resourceManager.GetTexture("Magi/up.0"),
                _resourceManager.GetTexture("Magi/mid.0"),
                _resourceManager.GetTexture("Magi/down.0")
            };
            _texM20 = new Texture2D[]
            {
                _resourceManager.GetTexture("Magi/up.-20"),
                _resourceManager.GetTexture("Magi/mid.-20"),
                _resourceManager.GetTexture("Magi/down.-20")
            };
            _tex20 = new Texture2D[]
            {
                _resourceManager.GetTexture("Magi/up.20"),
                _resourceManager.GetTexture("Magi/mid.20"),
                _resourceManager.GetTexture("Magi/down.20")
            };
            _tex90 = new Texture2D[]
            {
                _resourceManager.GetTexture("Magi/up.-90"),
                _resourceManager.GetTexture("Magi/mid.-90"),
                _resourceManager.GetTexture("Magi/down.-90")
            };
        }
Exemple #4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            _resourceManager = new ResourceManager(Content);

            base.Initialize();
        }