[Solved] - In Laser Defender, enemy's laser speeds are unequal

Unity build: 4.6.9

Problem:

When the enemy ships begin firing, their first shots are very fast. Then the lasers get slower, but if you look carefully, some of the lasers still move faster.

To try and locate the problem, I stripped my code down to everything that has to do with laser speed:

http://pastebin.com/5RA8NNe0

I still couldn’t figure out what was wrong: My_LaserDefender.zip (1.8 MB)

(If you download the project files, note that the Enemy’s script is set to “Enemy_Behavior2” rather than “Enemy_Behavior”. Number 2 is just the stripped down version of number 1.)

Solution:

I removed “Time.deltaTime” from this line because I already have it in another line:

	Red_Laser.rigidbody2D.velocity = new Vector2(0,-laser_speed) * Time.deltatime;

I’m not sure why that caused a problem, but thanks to @Marc_Carlyon for helping me find it.

1 Like