- Home /
Smoothly move 2D Sprite
So, I'm working on a Platformer game, but when I move forward, I move forward in gaps. I want to move smoothly. Any suggestions? Thanks!
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Player : MonoBehaviour {
private float Speed;
void Start () {
Speed = 3f;
}
void Update () {
if (Input.GetKeyDown(KeyCode.UpArrow))
{
transform.Translate(Vector3.up * 75 * Time.deltaTime);
}
if (Input.GetKeyDown(KeyCode.RightArrow))
{
transform.Translate(Vector3.right * 50 * Time.deltaTime);
}
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
transform.Translate(Vector3.left * 50 * Time.deltaTime);
}
}
}
Answer by Lost_Syndicate · May 24, 2018 at 02:46 AM
Maybe use this.GetComponent<Rigidbody>().AddForce(Vector3.right * 50 * Time.deltatime);
Now it didn't move at all. Thanks anyways! :)
Answer by VOLTAGE_Animation_Studios · May 24, 2018 at 01:05 AM
P.S. so far speed is there for ABSOLUTELY nothing. This script works but, it's kinda crappy. I go like one inch of my monitor at a time. It looks freaking pathetic! lol
Your answer
Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
How do i maintain the same speed in the air? 1 Answer
Don't Flip Child, Only Parent. 0 Answers
audio doesn't play on movement 0 Answers