Day 2: Giving the Player a Laser

Today I was able to give my player a laser. I use instantiate() to spawn the laser slightly in front of the player when they press the spacebar and then use transform.translate() to get the laser moving. I use Destroy() to get rid of the laser when it goes off screen. The laser also has a delay using Time.time to prevent the player from spamming the lasers. I am having a blast and can’t wait to share more.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store