Skip to content
Menu
METAL MADNESS by Sam Cox
  • Home
  • Semester 2: Kinetic Panic
    • Reflection and Learning Outcomes
    • Final Weeks
    • Spring Break: March 29 – April 27
    • Ability Multiplier Text UI, Playtesting sessions, Checkpoints, Main Menu, Settings, Removing Ability Multiplier
    • UI, Possession Ability, Preparing for Playtesting
    • Reading Week, Feedback Session
    • Movement Acceleration Multiplier, Bonus Gravity,
    • Continuing work on gravity ability
    • Selection Area, Singleton Practice Session, Gravity Ability
    • Movement Improvements, Camera Fading, Instagram Page
    • Beginning Programming
    • Introduction
  • Weekly Blog
    • Reflection
    • Pitch – Week 10
    • Interactivity, UI, and Usability – Week 9
    • Feedback from friends – Week 8
    • Reading Week and Teacher Feedback – Week 7
    • Gameplay and Game Systems – Week 6
    • Narrative – Week 5
    • Character Design & Idea Change – Week 4
    • Platform specification and control mapping
    • Essential Experience – Week 3
    • World building and Plan of Action – Week 2
    • Hello universe & Idea Generation – Week 1
  • GDD
    • Overview
    • Gameplay
    • Story
    • Art
    • Mechanics
    • Sound
    • Market
  • Research
    • Researching Rides
    • Researching Characters
    • Researching UI
    • Researching the market
    • Researching Music & Sound
METAL MADNESS by Sam Cox

Movement Acceleration Multiplier, Bonus Gravity,

Posted on April 28, 2025

Movement Acceleration Multiplier

One of the suggestions I got from Guy was to make the player go faster, and so what I did was this, I made the player go progressively faster if they held down the move key, but reset it if they let go.

At the end of the MovePlayer function, I added this AddMovementMultiplier

    void AddMovementMultiplier()
    {
        float newMultiplier = _movementMultiplier += movementMultiplierAmount;
        if (newMultiplier > maxMovementMultiplier)
        {
            return;
        }
        if (Mathf.Approximately(newMultiplier, maxMovementMultiplier))
        {
            _movementMultiplier = maxMovementMultiplier;
        }
        else
        {
            _movementMultiplier += movementMultiplierAmount;
        }
        Debug.Log($"movementMultiplier: {_movementMultiplier}");
    }

And then when the player stops moving, the _movementMultiplier is set to 0.

I also added a maxMovementMultiplier float to stop the player from going to fast and accelerating to ridiculous, uncontrollable speeds.

Bonus Gravity

Another change I made was an addition of a ForceMultiplier variable. Firstly, I made some changes to the PlayerInput, adding Inputs to accommodate the arrow keys.

Then, I added code in the SelectionArea script. I made a new float called abilityMultiplier and then some functions that interacted with the new Inputs I added.

public void ScrollUp(InputAction.CallbackContext context)
    {
        if (!context.performed) return;
        abilityMultiplier += 1;
        Debug.Log($"Scrolling up ability multiplier: {abilityMultiplier}");
    }

    public void ScrollDown(InputAction.CallbackContext context)
    {
        if (!context.performed) return;
        if (abilityMultiplier > 0)
        {
            abilityMultiplier -= 1;
        }
        else
        {
            abilityMultiplier = 1;
        }
        Debug.Log($"Scrolling down ability multiplier: {abilityMultiplier}");
    }

Then, in PlayerAbility, when the MoveObjectUsingGravity IEnumerator is called, a Vector3 called forceToAdd is made.

        objectRb.useGravity = false;
        Vector3 forceToAdd = Vector3.up * (radius * _forceAmount * abilityMultiplier);
        Debug.Log($"Force to add {forceToAdd}");
        objectRb.DOMove(objectRb.transform.position + forceToAdd * Time.fixedDeltaTime, forceMovementTime);
        yield return new WaitForSecondsRealtime(forceMovementEnd);
        objectRb.useGravity = true;

One of the changes I also made for the gravity ability is that, instead of moving the objects rigidbody, I added a force to the object affected by the ability, and so the DOMove would be replaced with this:

objectRigidBody.AddForce(Vector3.up * radius * _forceAmount, ForceMode.Acceleration);

On Thursday, I provided this summary of what I did to the Discord server:

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

©2025 METAL MADNESS by Sam Cox | WordPress Theme: EcoCoded