a simple algorithm for camera shaking
SOUND* explosion_wav = "explosion.wav";
function roll_startup()
{
var shaking_time = 3; // shake the camera for 3 seconds
while (!key_e) {wait (1);} // press the "E" key to start the explosion (camera shaking)
while (key_e) {wait (1);} // waut until the player releases the "E" key
snd_play (explosion_wav, 100, 0);
while (shaking_time > 0)
{
shaking_time -= time_step / 16; // subtract a value of 1 from shaking_time each second
camera.roll = 3 - random(6); // shake the camera by changing its roll angle, play with the numerical values
wait (1);
}
camera.