Categories
Game Creation Mastering Development

I use a SendMessage function for my melee attack, but for this enemy it doesn’t work

I have a melee attack script that work like a charm for the other enemy. But for this one enemy, it doesn’t work. This is the script for the melee attack which utilises the SendMessage function. You can see that there is a Debug.Log statement whenever my player hits something. For the enemy that doesn’t […]

Categories
Development Game Creation

Implementing moving animation

I faced the problem of attaching animation to the enemy. In the Animator window I added a “moveSpeed” (float) condition, so moving animation should turn on when moveSpeed is greater than 0.001. But after prescribing a reference to an Animator in the code, whatever I write further, a message pops up about the presence of […]

Categories
Development Game Creation

Why does simply trying to add sound break literally everything

So I have a script for an object that when shot explodes and it worked literally perfectly until I tried to add sound at which point it not only didn’t play the sound but also stopped exploding, which was pretty rude of it. Here’s my code since I have no idea what’s wrong: (Unity C#) […]

Categories
Mastering Development

Why the object keep moving up nonstop and how to move it forward fast when it finished moving up?

I want to move the object up smooth slowly from it’s current position on y 50.01 to new position 51.255 But the object keep moving up nonstop. using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; public class RoboSphereWindowBreakInteraction : MonoBehaviour { public Transform target; public AudioClip audioClip; public float speed; private bool hasStarted […]

Categories
Development

why isn’t the position updating?

So, I have a game where there is the player and the enemy. The enemy should follow the player when he sees him (is in range).But only the enemies that spawns near him (in range) follows him,the rest just ignores the player even if the player is in the range.This is because the position is […]

Categories
Development

Why arent the enemies following the player?

So, I have a game where there is the player and the enemy. The enemy should follow the player when he sees him, not when starting the game. Only the enemies that are in appropriate range will follow the player. The rest will just ignore him. I have tried to loop it by returning the […]

Categories
Development

Why does the code work only at the beginning?

So, i have a game ,there is the player and the enemy,the enemy should follow the player when he sees him,instead when starting the game, only the enemies that are in apropriate range are following the player and the rest just ingores him ,i have tried to loop it by returning the code when the […]

Categories
Development Unity

Unity – Projectile Motion, find the angle needed to hit coordinates x,y

Plenty of questions asked around the same topic, but nothing seems to be working for me. The problem is simple, a player and an enemy are on the x,y plane. I want to launch my projectile at a calculated angle in such way that the projectile will hit the enemy at it’s coordinates. I’ve tried […]

Categories
Development Unity

Unity tutorial- Gameobject won’t destroy

I’m following a Udemy 2D tutorial in Unity to create a 2D pixel game. Language is C#. I am simply copying down the code because I am unfamiliar with coding, however I copied down the code to a T and I am having issues with one of my GameObjects. The objective is to destroy my […]

Categories
Development

Instantiate gameObject on mouse input position goes to the center of map

I have a large 3d cube. I want the player to be able to instantiate a game object wherever they want on this cube. If they click, I want the object to be created where their mouse currently is. For some reason, the object is always instantiated at 0,0,0 instead of where the mouse is. […]