Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Enemy : MonoBehaviour
- {
- public int Damage;
- public float Speed;
- private void Update()
- {
- transform.Translate(Vector2.left * Speed * Time.deltaTime);
- }
- private void OnTriggerEnter2D(Collider2D collision)
- {
- if (collision.CompareTag("Player"))
- {
- collision.GetComponent<Player>().ApplyDamage(Damage);
- Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement