Juice It Good: Adding Camera Shake To Your Game

Antonio Delgado
3 min readMay 11, 2021

--

Juice or “game feel” is the intangible but tactile feedback associated when playing games. Enemies exploding in a shower of particles, screen shudder, and other small but satisfying forms of feedback can help create a more polished and engaging game, separating what a boring otherwise static game into something addictive.

This article will cover specifically the juiciest of feedback, camera shake. When used correctly it can create some of the most engaging game feel with a few simple lines of code but if used incorrectly can make players feel nauseous. Worse yet it can be perceived as annoying and turn off players entirely, so is best used sparingly. Below is entire script for screen shake, this is attached to the main camera and is constructed so that it can be used from anywhere in the game.

So how does this work in practicality? Let’s take a look using Atomic Shooter as an example. There’s a slight shake when the player fires as shown in the code snippet. By making CameraShake a singleton, this can be called from anywhere in the game at any time.

So here’s it in action. The shake is subtle but consistent creating a slight “rumble” feeling when the player is firing their main weapon.

Next we’ll add a more aggressive shake to destroying our enemies. Dropping this in right before our enemies destroy themselves and the UI updates.

Here’s the shake in action, more robust than the firing but not to the point of overpowering the player and destroying readability of the game.

The idea is that if the player destroys dozens of enemies at once they don’t overwhelm the player with insane amounts of screen shake. Just a nice consistent rumble to provide feedback. Hopefully with code in hand and some practical examples given you can now give the juicy feedback your games may have needed. This system is versatile enough that you can extend and use it in just about any game be it 2D or 3D, just slap it on your camera and go nuts. Until next time happy coding.

--

--