Exemplo n.º 1
0
		/// <summary>
		/// Play the specified paused and return the newly created SoundChannel
		/// </summary>
		/// <param name='paused'>
		/// When set to <c>true</c>, the sound is set up, but remains paused.
		/// You can use this to set frequency, panning and volume before playing the sound.
		/// </param>
		/// <param name='channelId'>
		/// When in range 0...31, the selected channel will be used. If it already
		/// contains a playing sound, that sound will be stopped.
		/// When set to -1 (the default), the next free channel will be used.
		/// However, when all channels are in use, Sound.Play will silently fail.
		/// </param>
		public SoundChannel Play( bool paused = false, int channelId = -1 )
		{
			int id = 0;
			FMOD.System_PlaySound( _system, channelId, _id, paused, ref id );
			SoundChannel soundChannel = new SoundChannel( id );
			return soundChannel;
		}
Exemplo n.º 2
0
        private void getCollisionPlayer()
        {
            if (HitTest(_level.player))
            {
                SoundChannel soundChannel = new SoundChannel(2);
                Sound pickup = new Sound("coin.wav");
                pickup.Play(false, 2);

                _level.thisgame.playerCoins++;
                _level.player.addPoints(40);
                Destroy();
            }
        }
Exemplo n.º 3
0
        private void getEnding(bool pLevelWon)
        {
            SoundChannel soundChannel = new SoundChannel(2);
            if (pLevelWon)
            {
                Sprite background = new Sprite("youwon.png");
                AddChild(background);

                Sound youWonSound = new Sound("youwin.mp3");
                youWonSound.Play(false, 2);
            }
            else
            {
                Sprite background = new Sprite("gameover.png");
                AddChild(background);

                Sound gameOverSound = new Sound("gameover.wav");
                gameOverSound.Play(false, 2);
            }
        }
Exemplo n.º 4
0
        private void getCollisionPlayer()
        {
            if (HitTest(_level.player))
            {
                if (_level.player.bulletCounter < 2f)
                {
                    _level.player.bulletCounter = 2f;
                }
                else if (_level.player.bulletCounter == 2f)
                {
                    _level.player.bulletCounter = 3f;
                }

                SoundChannel soundChannel = new SoundChannel(2);
                Sound reload = new Sound("reloadgun.mp3");
                reload.Play(false, 2);

                _level.player.bulletCounter = 3f;
                this.Destroy();
            }
        }
Exemplo n.º 5
0
Arquivo: Enemy.cs Projeto: mbos14/GTFO
        //gethit
        public void HitByBullet(float pBulletDamage, PlayerDirection pDirection)
        {
            SoundChannel soundChannel = new SoundChannel(2);
            Sound hit = new Sound("hurt.wav");
            hit.Play(false, 2);

            if (_state == EnemyState.death) return;

            if (_health <= 0f)
            {
                _state = EnemyState.death;
                _level.player.addPoints((int)_points);
            }
            else if (_health > 0f)
            {
                directionHit = pDirection;
                _health -= pBulletDamage;
                _hitTimer = pBulletDamage;
                _state = EnemyState.hit;
                _level.player.addPoints(10);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GXPEngine.Player"/> class.
        /// Sprite: http://opengameart.org/content/mv-platformer-male-32x64
        /// </summary>
        public Player(int lives)
            : base("Sprites/ninja_full.png", 10, 3)
        {
            _lives = lives;
            _moveSpeed = 4;
            _frame = 0.0f;
            _grounded = false;
            SetFrame (1);

            //http://opengameart.org/content/platformer-sounds-terminal-interaction-door-shots-bang-and-footsteps
            new Sound ("Audio/start.ogg").Play();

            //http://opengameart.org/content/platformer-sounds-terminal-interaction-door-shots-bang-and-footsteps
            _footStepSound = new Sound ("Audio/steps_platform.ogg", true);
            _footStepChannel = _footStepSound.Play (true);

            //http://opengameart.org/content/level-up-power-up-coin-get-13-sounds
            _coinPickupSound = new Sound ("Audio/Coin01.aif");

            //http://www.freesound.org/people/semccab/sounds/154403/
            _slideSound = new Sound ("Audio/slide.wav", true);
            _slideChannel = _slideSound.Play (true);
        }
Exemplo n.º 7
0
 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 //                                                                                                                        startMusic()
 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 void startMusic()
 {
     _music               = new Sound("background_music_main_menu.mp3", true, true);
     _musicChannel        = _music.Play();
     _musicChannel.Volume = 0.2f;
 }
Exemplo n.º 8
0
        private void shootBullet()
        {
            if (aimDirection == PlayerDirection.up)
            {
                recoil(aimDirection);
            }
            else if (aimDirection == PlayerDirection.down)
            {
                recoil(aimDirection);
            }
            else if (aimDirection == PlayerDirection.left)
            {
                recoil(aimDirection);
            }
            else if (aimDirection == PlayerDirection.right)
            {
                recoil(aimDirection);
            }

            PlayerBullet bullet = new PlayerBullet(aimDirection, _level);
            _level.backgroundLayer.AddChild(bullet);
            bullet.SetXY(x, y - (height / 2));

            SoundChannel soundChannel = new SoundChannel(2);
            Sound shootsound = new Sound("shoot.wav");
            shootsound.Play(false, 2);

            _level.thisgame.shakeScreen();
        }
Exemplo n.º 9
0
        private void handleInputHuman()
        {
            if (!Input.GetKey(Key.LEFT_SHIFT))
            {
                if ((Input.GetKeyDown(Key.W)) && _landed == true)
                {
                    _velocity.y -= _jump;
                    _landed      = false;
                }

                if (Input.GetKey(Key.A))
                {
                    _velocity.x = Utils.Clamp(_velocity.x - _speed, -5 - _topSpeed, 5 + _topSpeed);
                    this.Mirror(true, false);
                    left = true;
                    walkAnimationHuman();
                }

                if (Input.GetKey(Key.D))
                {
                    _velocity.x = Utils.Clamp(_velocity.x + _speed, -5 - _topSpeed, 5 + _topSpeed);
                    this.Mirror(false, false);
                    left = false;
                    walkAnimationHuman();
                }

                if ((!Input.GetKey(Key.A)) && (!Input.GetKey(Key.D)) && (!Input.GetKey(Key.W)) && (!Input.GetKey(Key.SPACE)) && _attackAnimation == false)
                {
                    idleTimer++;
                    if (idleTimer > 10)
                    {
                        idleHuman();
                    }
                }
                else
                {
                    idleTimer = 0;
                }

                if ((Input.GetKeyDown(Key.SPACE)) && _cooldown == 0)
                {
                    Projectile fireball = new Projectile(this);
                    _backgroundChanel        = _backgroundMusic.Play();
                    _backgroundChanel.Volume = 0.5f;
                    _level.AddChild(fireball);

                    _cooldown = 120;

                    if ((!Input.GetKey(Key.A)) && (!Input.GetKey(Key.D)))
                    {
                        _attackAnimation = true;
                    }
                }
                else
                {
                    if (_cooldown != 0)
                    {
                        _cooldown--;
                    }
                }

                if (_attackAnimation == true)
                {
                    if ((!Input.GetKey(Key.A)) && (!Input.GetKey(Key.D)))
                    {
                        HumanAttack();
                    }
                }
            }
        }