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

How to stop enemies from shooting each other

$
0
0
Okay so I'm making a 2D video game in the style of Space Invaders, but I'm having an issue where the enemies on the top row shoot those on the lower rows. I honestly don't know how to stop them from shooting. I have considered raycasting, but I haven't used that in a long time, and never on a 2D product. My current script controlling when they shoot looks like this: #pragma strict var enemyShot : Transform; var shotTime = 1000; var timeToShot = 0; function Start () { } function Update () { timeToShot ++; if (timeToShot == shotTime){ Instantiate(enemyShot, transform.position, transform.rotation); timeToShot = 0; } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



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