public class GoombaMove : MonoBehaviour
private BoxCollider2D gc;
public Collider2D GumbaBounce;
public Collider2D GumbaDie;
public float speed = 50f;
public float controlFactor = 0f;
public Sprite[] spritesArray;
[SerializeField] private LayerMask solidGround;
rb = transform.GetComponent<Rigidbody2D>();
gc = transform.GetComponent<BoxCollider2D>();
rb.velocity = new Vector2(-speed * Time.fixedDeltaTime - 1f, rb.velocity.y);
rb.velocity = new Vector2(speed * Time.fixedDeltaTime + 1f, rb.velocity.y);
private void OnCollisionEnter2D(Collision2D col)
if (col.collider.name == "Mario" && GumbaDie.IsTouching(Mario))
transform.Translate(Vector3.left * 99999999f * Time.deltaTime);
if (col.collider.name == "Pipe" && GumbaBounce.IsTouching(Obj1) && thing == 0)
rb.velocity = new Vector2(speed * Time.fixedDeltaTime + 5f, rb.velocity.y);
else if (col.collider.name == "Pipe" && GumbaBounce.IsTouching(Obj2) && thing == 1)
rb.velocity = new Vector2(-speed * Time.fixedDeltaTime - 5f, rb.velocity.y);
if (col.collider.name == "Bounce" && GumbaBounce.IsTouching(Obj2) && thing == 1)
rb.velocity = new Vector2(-speed * Time.fixedDeltaTime - 5f, rb.velocity.y);
else if (col.collider.name == "Bounce" && GumbaBounce.IsTouching(Obj1) && thing == 0)
rb.velocity = new Vector2(speed * Time.fixedDeltaTime + 5f, rb.velocity.y);