This commit is contained in:
Gerard Gascón 2025-04-24 14:23:29 +02:00
commit bd5b1556ff
269 changed files with 6249829 additions and 0 deletions

View file

@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Goomba : MonoBehaviour{
public float speed;
public float maxSpeed;
Rigidbody2D rb2d;
bool canMove;
// Start is called before the first frame update
void Start(){
rb2d = GetComponent<Rigidbody2D>();
}
void OnBecameVisible(){
canMove = true;
}
// Update is called once per frame
void Update(){
rb2d.AddForce(Vector2.left * speed);
float limitedSpeed = Mathf.Clamp(rb2d.velocity.x, -maxSpeed, maxSpeed);
rb2d.velocity = new Vector2(limitedSpeed, rb2d.velocity.y);
}
}