Temporary invulnerability in a platformer
Hello I'm working on a 2d platformer and I'm trying to give my player invulnerability for 3 seconds after getting hit. but I just cant seem to get it to work. any ideas how to fix this script? public...
View ArticleOverride a component method
I have a Health class which has methods TakeDamage() and Die(). My Enemy class has a Health component, so when my Enemy is taking damage Health.TakeDamage() is being executed. How do i go and override...
View ArticleEnemy doesn't shoot
So this is the script that manages the health and makes one of my enemies shoot, this script is in a child of the sprite so the players bullets don't interact with the collider that determines if the...
View ArticleEnemy walking off platform in Unity2D
In my game the enemy is suposed to be walking back and forth on top of a platform. I use raycast to notice the edge, but it only works once. The enemy will start on the left side, before moving to the...
View ArticleEnemy walking off platform in 2D mode
In my game the enemy is suposed to be walking back and forth on top of a platform. I use raycast to notice the edge, but it only works once. The enemy will start on the left side, before moving to the...
View ArticleHow can I get my enemy to hurt/kill player
Is there something wrong with this script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class EnemyAI : MonoBehaviour { private Animator...
View ArticlePlayer cannot destroy enemy
I have a game in which my main character "dashes" which triples their movement speed and allows them to destroy enemies. Player Code: //Starting Dash Coroutine. if (Input.GetButtonDown("Fire1")) { if...
View Articleenemy walking around the room 2d
Hello! I want to make enemy walking around the room in 2d mode: 1) if in front of enemy will be a wall enemy must turn right. 2) if on the left side the wall is finish then enemy must tern left. It's...
View ArticleEnemy death on jump,Jump on enemy to destroy
New to unity and was wondering to destroy an enemy by jumping on them.
View ArticleHow Do I Ignore a Collision Between an Enemy and the Player?
So I'm attempting to make my first 2D platformer with Unity 2D, and I came across a somewhat specific problem regarding collision between an enemy and the player. Following a tutorial I found on...
View ArticlePlayer Damage to enemy damage melee system
Good day! I have finally learned how to do melee system by watching a video here:https://www.youtube.com/watch?v=TWQlNztOoSM I have learned alot from this video, and I recommend you watch it too. My...
View ArticleMaking an NPC go up and down in UNITY
So I have this code, it is to make an enemy up and then down using waypoints, it actually works, but for a strange reason after some looping between the waypoints it goes all the way up to the infinity...
View ArticleHow to make a script start working, when the player is close enough? C#,How...
So I want my enemy to fire bullets once the player is close to it and not when the player is not that close to the enemy. Any help would be appreciated!,
View ArticleSync animation with damage deal
Hello, I have a problem. I can't sync animation and making damage. I'm using Animation Events, but everytime i press the button for attack, it takes damade. Thanks This is the AI health script public...
View ArticleHow do I make this equal to a Transform?
using System.Collections; using System.Collections.Generic; using UnityEngine; public class BeeScript : MonoBehaviour { public float Speed; public Rigidbody rb; public Transform Target; // Start is...
View ArticleEnemy script worked and now it just doesnt?
Does anyone know what causes this, the script now just throws this error? NullReferenceException: Object reference not set to an instance of an object EnemyController.Update () (at...
View ArticlePlayer attacks once but the enemy takes double damages!
Player attacks once but the enemy takes double damages, sometimes the i=0, sometimes the i=1, it's very strange: //Player Attack Method void Attack() { if (Input.GetButtonDown("Attack")) {...
View ArticleHow do i stop an asset from deleting the ground when it dies?
I have an asset (enemy) and when it is hit by a bullet it dies. I need it to kill the player if they were to ever touch, but when i check "is Trigger" it dies and deletes the ground. Any suggestions on...
View ArticleHow come my Player, Enemy & HealthSlider won't correspond to one another?
I am lost... everything makes sense when I read it, but I am not sure why it is not getting the damage from the enemy and decreasing my player's health bar. My hurt animation is going crazy too. Its...
View ArticleSo i am making an enemy that goes towards player's initial direction but...
float speed = 3f;//speed of object GameObject player; //Reference of player // float waitTime;//Time to wait // public float startWaitTime; Vector2 playerPos;//To know position of player private void...
View Article