How do I make the screen shake?

For example if lightning struck, then I’d want the screen to shake. Like in “The Graveyard” on FlowLab.

Here’s one way: http://flowlab.io/game/view/671939

It just adds a small random offset to the camera each frame. You can import that bundle directly if you want, just click your behavior window, select “import” in the wheel menu and paste this in:

{"behavior":{"v":"2","links":[{"input_id":"49da1ef029bb9b44i3","output_id":"49da1ef3b441d847o0"},{"input_id":"49da1eee9d4eb94di2","output_id":"49da1ef1471cab49o0"},{"input_id":"49da1eefef8df14fi0","output_id":"49da1eee9d4eb94do0"},{"input_id":"49da1ef3b441d847i0","output_id":"49da1eee9d4eb94do0"},{"input_id":"49da1ef029bb9b44i2","output_id":"49da1eefef8df14fo0"},{"input_id":"49da1eee9d4eb94di0","output_id":"49da1ef3427e1c40o0"},{"input_id":"49da1ef3427e1c40i0","output_id":"49da1ef064d7ca41o0"},{"input_id":"49da1eee9d4eb94di1","output_id":"49da1ef064d7ca41o0"}],"nodes":[{"inputCount":1,"name":"Screen Shake","isMenuItem":true,"behaviorType":"logic.NodeGroup","outputCount":0,"y":-192,"x":-180,"group":"","id":"49da1eed3a0f4348"},{"inputCount":3,"name":"Random","max":4,"behaviorType":"logic.logic.Random","outputCount":1,"y":288,"min":-4,"x":810,"group":"49da1eed3a0f4348","id":"49da1ef3b441d847"},{"inputCount":0,"name":"Always","behaviorType":"logic.triggers.Always","outputCount":1,"y":352,"x":450,"group":"49da1eed3a0f4348","id":"49da1ef1471cab49"},{"inputCount":3,"name":"Switch","behaviorType":"logic.logic.Switch","outputCount":1,"y":256,"x":630,"group":"49da1eed3a0f4348","id":"49da1eee9d4eb94d","_startVal":0},{"x":990,"y":224,"top":0,"minLeft":0,"group":"49da1eed3a0f4348","id":"49da1ef029bb9b44","bottom":9,"inputCount":4,"name":"Camera","scrollY":true,"behaviorType":"logic.components.View","outputCount":4,"scrollX":true,"repeatBG":false,"maxRight":18,"parallax":100},{"inputCount":3,"name":"Random","max":4,"behaviorType":"logic.logic.Random","outputCount":1,"y":192,"min":-4,"x":810,"group":"49da1eed3a0f4348","id":"49da1eefef8df14f"},{"count":1,"name":"Timer","behaviorType":"logic.triggers.Timer","outputCount":1,"y":128,"inputCount":3,"x":630,"delay":20,"group":"49da1eed3a0f4348","id":"49da1ef3427e1c40"},{"inputCount":0,"name":"Bundle Input","tag":"shake","behaviorType":"logic.NodeGroupInput","outputCount":1,"y":256,"portId":"49da1eed3a0f4348i0","x":450,"group":"49da1eed3a0f4348","id":"49da1ef064d7ca41"}]}}

Ill try this out now and update you. Thanks :slight_smile:

Edit: Works! Thanks :smiley: