How to destroy all enemies within a certain collider?
Hey everyone, I'm remaking a level from Mega Man 2, and when I leave a room I want all the enemies still alive in that room to be destroyed. I have a BoxCollider2D covering each room with this...
View ArticleHow to move an GameObject to a random position in a defined area?
Hey everyone, so I have this bat enemy that once it hits the player, it is supposed to move to a position back in the trees (the red rectangle) and then start chasing the player again. I'm not quite...
View ArticleHow do I hurt enemies by jumping on them without getting killed?
I have half of the code already written. I am just not sure if the player will get hurt since I have the enemies hurt my player through collisions. The code here is for the enemy. If i switch this code...
View ArticleHow to rotate the raycast on a patrolling enemy? (In front of the enemy at...
I am having trouble rotating my raycast (LineOfSite) on my enemy player. So when the enemy is patrolling the area. The player is able to steps on the ray cast, behind it because it set it up to point...
View Articlehave friendly AI look at enemy
using UnityEngine; using System; using UnityEngine.AI; public class Sense : MonoBehaviour { public float checkRadius; public LayerMask checkLayers; public NavMeshAgent myNavMesh; private GameObject[]...
View ArticleEnemy not getting hit (Collider and Raycast)
I tried getting my enemy to fall underneath the ground and when it reaches Y: -20 it destroys which is in a separate code. The enemy. is not moving when my Player jumps on top of it. Here is the code...
View ArticleHow should I code for multiple types of enemy with specific action set?
Greeting all. I just have a quick question regarding how to code for multiple types of enemies for my game. Currently I have a game and I have a script to handle the enemy stats and a script to handle...
View ArticleEnemy Health Won't Show When Mouse Over,
I have this code for the enemy and I made it so when you hover over the enemy, the health bar will show, and when you click the enemy, it will take health off the enemy. But the OnMouseOver,...
View ArticleUnity AI/Enemy won't move towards target
Hello programmers around the world. I've been developing an AI for enemy and so far I have him wandering around. He can also detect the player but when that happens he should start moving towards him...
View ArticleSpace between gameobjects
Hi! I have a lot of enemies in my 2D scene, I want that there is a space between them, so that they do not all stand in the same place when they follow the player, how could I do it? Thanks :)
View ArticleHow can I make an enemy follow the player when the player is not looking at...
I’m new to Unity. I need a script to make an enemy object follow the player when it’s not being watched by the player. Right now my enemy is nothing but an object without script and my player has a...
View ArticleWhy is my character taking damage when attacking & why is it attacking...
I use a trigger jump attack on my player. The problem is that when I touch the enemy once it takes 40 damage. My player also takes damage whenever I touch the enemy. MY player attack damge is set to 10...
View ArticleEnemy flying
so im creating a enemy in a game where it will go after a building but if the player come withing a distance its attacking the play but i have a problem where if the enemy is attacking a building its...
View ArticleEnemy help
so im creating a enemy in a game where it will go after a building but if the player come withing a distance its attacking the play but i have a problem where if the enemy is attacking a building its...
View ArticleMy Player only gets hurt on one side
Right Now i am working on if the player get hit from the enemys in the level, but im only having it work from one side heres my code `public enum DIRECTION { UP, DOWN, LEFT, RIGHT } private bool...
View ArticleEnemy attack target
How do i make so when the enemy comes within a attack radius its damaging the target there is 2 different targets there is a building and there is a player so how do i make it attack the target there...
View ArticleCollider Tag not working for enemy
I'm having a problem with letting the bullet notice it is an Enemy. This only happens when I try to use an explosionRadius. The enemy Prefab is correctly tagged as "Enemy", but it still won't recognize...
View ArticleEnemy animation based on direction
Hello. I am currently making a Maze game, where the enemies always follow a certain path determined by waypoints. I want the enemies to change their walking animation when they are facing left, right,...
View ArticleMake an enemy stop at a radius
So i have this enemy and i want it to stop when i reaches its throwraidus how do i do that void Update() { TargetFinder(); if (CurrentStones > 0) { if (myTarget == null) currentTargetDistance =...
View ArticleEnemy attacking to fast
So I have this enemy there is going to throw stone but I have that one problem that it throws all of it stone at once and I want it to wait between each throw can someone help me? { TargetFinder(); if...
View Article