What I am trying to do is boost the speed in the paddle by pressing a button in Block Breaker. My last post was closed so I had to make a new one.
Here is the code I am using.
‘’'public class MoveLR : MonoBehaviour
{
public float PlayerSpeed = 5;
bool mofe = false;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float amtToMove = Input.GetAxis("Horizontal") * PlayerSpeed * Time.deltaTime;
transform.Translate(Vector3.right * amtToMove);
}
private void Mofast()
{
if (CrossPlatformInputManager.GetButtonDown("Fire1"))
{
PlayerSpeed = 20f;
}
}
}
/* mofe = PlayerSpeed = 20 How to temporarily increase the speed of a character in a Unity game - Game Development Stack Exchange */
‘’’
This is the old post.
How to apply code formatting within your post