Galaxy Shooter — Phase I: Framework
May 3, 2021
Day 37 — Aspiring Game Creator
2D Game Dev: Galaxy Shooter
Objective: Camera Shake when Player damaged.
Pseudo Code:
- Add Cinemachine to project.
- Add Cinemachine Brain to Main Camera.
- Create a new Cinemachine Virtual Camera (CM vcam1).
It is the NOISE of the virtual camera that allows for the camera shake functionality. The noise type needs to be switched to Basic Multi Channel Perlin.
The CinemachineShake script will use the initial intensity amount to start and lerp over time lessening the intensity of the shake.
Below the final explosion ROCKS the screen and quickly abates over a few seconds.
Once the CinemachineShake script is in place, making a call to the method when the ship is damaged or destroyed is all done through the damage method.