Skip to content

Instantly share code, notes, and snippets.

@curious-username
Created September 17, 2021 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save curious-username/d7e21527da3101fcfab43339a07c74cd to your computer and use it in GitHub Desktop.
Save curious-username/d7e21527da3101fcfab43339a07c74cd to your computer and use it in GitHub Desktop.
enemy script for toaster
public class Enemy : MonoBehaviour
{
private float _speed = 4.0f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.Translate(Vector2.down * _speed * Time.deltaTime);
if (gameObject.transform.position.y < -5.6f)
{
Destroy(gameObject);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment