예제 #1
0
        public void Update(Vector2 _position)
        {
            position.X = _position.X;

            if (position.X >= CDino.position.X && position.X <= CDino.position.X + CDino.drawRec.Width * Game1.scale &&
                position.Y >= CDino.position.Y && position.Y <= CDino.position.Y + CDino.drawRec.Height * Game1.scale)
            {
                Game1.score = 0;
                if (audio_played != true)
                {
                    CSoundManager.PlaySound(1);
                    audio_played = true;
                }
            }
        }
예제 #2
0
        protected override void Initialize()
        {
            base.Initialize();

            Window.Title             = "Monogame TRex Runner";
            this.IsMouseVisible      = true;
            Window.AllowUserResizing = true;

            _graphics.PreferredBackBufferWidth  = 600;
            _graphics.PreferredBackBufferHeight = 500;
            _graphics.ApplyChanges();

            Dino         = new CDino(dinoTexture, new Vector2(110, 200));
            SoundManager = new CSoundManager(soundEffects);

            for (int i = 0; i < 13; i++)
            {
                Dirts.Add(new CDirt(spriteSheet, new Vector2(72 + ((16 * 3) * i), 250), false));
            }
        }
예제 #3
0
        public void Update()
        {
            if (CKeyboard.SpacePressed())
            {
                if (position.Y == defPosY)
                {
                    position.Y -= 1f;
                    velocity   += 5;
                    OnGround    = false;
                    CSoundManager.PlaySound(0);
                }
            }

            Gravity();

            if (velocity < 0 && CKeyboard.DownArrowPressed() && OnGround == false)
            {
                velocity -= 0.3f;
            }

            Animate();
        }