EmptyObkectWithLasers.GetComponent<Rigidbody2D>.velocity = new Vector2(0,30)

Trying to add power ups to my defender game. I got power up spawner, player is picking them up successfully, figured to bundle lasers into empty game object to spawn it when player’s weapon power up int increases. So I have if statements in my IE numerator, when int Powerup is 1 -instantiate regular laser, if 2or more -instantiate prefab of lasers inside empty object. It spawns but won’t move. Tried to add rigid body to empty -still won’t work.

The only solution I got is to attach new scripts with updating transform.translate method to prefabed laser, and when instantiating object with prefabed lasers -they fly, and then added destroy script on parent object because when lasers die before hitting shredder, parent stays in a game. So my script deletes it after 2 seconds after instatiating. Sounds like problem is solved, I got my player to powerup up to 5 lasers, but when I was trying to create new type of weapon for player, where a projectile rotates, just like recent big enemy we made, the projectile doesn’t rotate, it drifts to the left, and if angle is too high, it just flies around the screen

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms