CakeMeister

Spikes phan 9

Jul 2nd, 2017
1,389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Spikes : MonoBehaviour {
  6.     public Player player;
  7.  
  8.  
  9.     // Use this for initialization
  10.     void Start () {
  11.         player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
  12.     }
  13.  
  14.     private void OnTriggerEnter2D(Collider2D col)
  15.     {
  16.         if (col.CompareTag("Player"))
  17.         {
  18.             player.Damage(2);
  19.             player.Knockback(400f, player.transform.position);
  20.         }
  21.     }
  22. }
Add Comment
Please, Sign In to add comment