Created
September 17, 2021 03:09
-
-
Save curious-username/d7e21527da3101fcfab43339a07c74cd to your computer and use it in GitHub Desktop.
enemy script for toaster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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