Question by
rhinosaiyan · May 24, 2016 at 02:20 PM ·
not working
When I hit spikes on my game the knock back doesnt work. Can anybody tell me why
(My script for the spikes)
using UnityEngine; using System.Collections;
public class Spikes : MonoBehaviour {
private Player player;
void Start()
{
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
}
void OnTriggerEnter2D(Collider2D col)
{
if (col.CompareTag("Player"))
{
player.Damage(2);
StartCoroutine(player.Knockback(0.02f, 400, player.transform.position));
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612081419im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Player flying into oblivion. 2 Answers
GUI.Button is not doing anything 0 Answers
Inconsistent input detection across different computers 0 Answers
MonoDevelop not starting (different from last time) 0 Answers