[SOLVED]Shake camera effect

Hi Folks! I am a long time “away” from the forum, but still studying Gdevelop…

Well, is there a way to create a “camera shake” effect when something explode, for example?
Thanks!

There is a way to create camera shake.

Yes, I bet there’s a way, but I’ve tryed a simple test with a simple action, using camera angle change( centering character), but the values change too much the angle( i’ve tried with 0.01 and -0.01 ).

Hi, I retouched an old example, here it is (last GD version required) :
CameraShake.rar (10.6 KB)

Note that this work just to simulate “hard” shakes as explosions, earthquakes, etc… Doesn’t work to simulate soft moves as a ship over sea waves (instead modify the movement and roll speed, you should modify the accelerations) :slight_smile:

Events → Insert an event from the event store → Camera shake

Hey! Thanks Lizart-13 !
That is what I was trying to make happen!

Nice code! Credits will be inserted, be sure!

I’ve changed somethings, by including a key(s) to trigger the shake, and another one(z) to stop shake.
Now I can use it for a big shot, but I do not know if I did the right way. I am not a coder, but an animator.

It’s attached(with image files included).
http://www.mediafire.com/download/90rhdzh7taqo9ri/CameraShake.tar.gz

Now I would like help for a “handcam” effect, for a first person view of screen, but I’ll create another post for that.

I can improve it a bit:
CameraShake.gdg (57.8 KB)
Just added a variable “ActiveShake”, “s” and “x” keys toggle it (1 to activate it, 0 and reset camera position and angle to deactivate it). It is cleaner, and has a better performance since it doesn’t compute anything about the shake effect if it is deactivated :wink:

Hey ! This topic is really interesting, but i fail into adapting what you’ve made.

I use 3 cameras like in the parallax platformer tutorial, and where you use a static a view, i’ve already a camera that is following an object (and 2 others in the background with 0.25* and 0.50* speed for parallax effect).

I’d like to use it with my “Player” object (wich is moving) as the CameraTracking object of the example you’ve done. Any tips or ideas ?

I’ve tried (at last) to use a false CameraTracking object on the HUD layer (wich is not moving), but it doesn’t work the way i wish.

EDIT : forgot about that, i developped something new, simplest, and just for what i need ( i just use a force for a few second on the tracked object with -1 elasticity, it’s just perfect for camera shaking on explosion, furthermore : no blurring on objects + no clipping of scaled background !:)).

2 Likes