GameDevHQ Crash Course Day#3 Lasers are always good

Jason Dixon
2 min readMar 15, 2021

--

Today went over different ways to implement the ability to fire for the player ship, two main methods are every key press and press and hold, I implemented them both to see how I wanted the game to feel and while the every key press made it more reminiscent of older arcade games, how I envisioned the game going I wanted a way to continually fire while I held down a key.

Coroutines are interesting and can open up a new way of doing parallelish methods, you fire the first part of the method up until the yield return then it comes back after the yield condition is valid to continue the method and using a while(true) method it loops forever with set intervals between loops without having to recall the method constantly.

also implemented a way of removing those lasers after they hit a certain point out of bounds because you don’t want your memory to end up flooded with millions of lasers moving off screen that will never be seen.

--

--

No responses yet