Hello, it’s my first time doing the game. My problem is that, when I’m trying to rotate my tetromino, it tp all around my map. Someone knew how I can fix that issue? Thanks, a lot
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
transform.position += new Vector3(-1, 0, 0);
if (!ValidMove())
transform.position -= new Vector3(-1, 0, 0);
}
else if (Input.GetKeyDown(KeyCode.RightArrow))
{
transform.position += new Vector3(1, 0, 0);
if (!ValidMove())
transform.position -= new Vector3(1, 0, 0);
}
else if (Input.GetKeyDown(KeyCode.UpArrow))
{
//rotate !
transform.RotateAround(transform.TransformPoint(rotationPoint), new Vector3(0,0,0), 90);
if (!ValidMove())
transform.RotateAround(transform.TransformPoint(rotationPoint), new Vector3(0,0,0), -90);
}
if (Time.time - previousTime > (Input.GetKey(KeyCode.DownArrow) ? fallTime / 10 : fallTime))
{
transform.position += new Vector3(0, -1, 0);
if (!ValidMove())
transform.position -= new Vector3(0, -1, 0);
previousTime = Time.time;
}
}