# How do I make the screen shake when the player takes damage?

I am making a 2D game and I'd like a visual cue when the player gets hurt. Currently, I have a simple blinking red dot that shows up for 2 seconds after damage, but it's not very immersive.

Many games shake the screen to indicate damage. How could I implement such an effect?

• Is there anything that you have tried so far? Feb 22 '14 at 1:35

When that vector is (0,0), the screen is still. Changing it randomly every 5-10 frames causes the screen to shake. You can smooth this change if you like.