Пример #1
0
        // Edit this function freely!
        // TODO: Disable ceiling bounce.
        private float getWallBounce(float value, GravitySide gravitySide)
        {
            // No bounce at all
            if (gravitySide == GravitySide.Left)
                return -gravityForce.X;
            else if (gravitySide == GravitySide.Right)
                return gravityForce.X;
            else if (gravitySide == GravitySide.Up)
                return -gravityForce.Y;
            else if (gravitySide == GravitySide.Down)
                return gravityForce.Y;
            else
                return 0;

            // No bounce on the floor
            //if (this.gravitySide == gravitySide) return 0;

            // Bounce on the floor:
            // if (this.gravitySide == gravitySide) return (float)(value * -1 * .5);

            // Bounce on any other side:
            //return (float)(value * -1 * .5);
        }
Пример #2
0
        private void spawnPlayer(SpawnPosition newSpawn)
        {
            // Reset the player's heath:
            playerHealth = playerMaxHealth;

            // Assign the new location and gravity angle:
            position    = newSpawn.GetSpawnVector();
            velocity    = new Vector2();
            gravitySide = newSpawn.GetSpawnGravitySide();
            weaponManager.dropPickUpWeapon();

            // OPTIONAL: Add some code here to remove all player's bullets from the game.
        }
Пример #3
0
 public void setGravitySide(GravitySide gravitySide)
 {
     // Singleton, we can only switch if the gravity side isn't set to this value already.
     if (this.gravitySide != gravitySide)
     {
         isJumpAllowed = false;
         this.gravitySide = gravitySide;
     }
 }