Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

Player taking "2 hp" damage instead of 1

$
0
0
hi, i wanted help with damage, so i just made a simple script, it's just an image which damages the player when collides with the player, but for some reason the player takes damage of 2 hp instead of 1, and i can't figure out why that happens and how to fix it . using System.Collections; using System.Collections.Generic; using UnityEngine; public class DamageOnCollision : MonoBehaviour { private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Player")) { collision.gameObject.GetComponent().TakeDamage(1); } }}

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>