Fangames > Programming Questions

Screen shake motion blur

<< < (2/2)

Kyir:
As for screen shake, you basically just want to adjust the view_angle (be sure to enable views in whatever screen you're doing this in). You can fiddle with the other stuff in https://docs.yoyogames.com/source/dadiospice/002_reference/windows%20and%20views/views/index.html but the angle is the easiest I've found.

Katz:

--- Quote from: Kyir on August 06, 2015, 09:16:04 PM ---As for screen shake, you basically just want to adjust the view_angle (be sure to enable views in whatever screen you're doing this in). You can fiddle with the other stuff in https://docs.yoyogames.com/source/dadiospice/002_reference/windows%20and%20views/views/index.html but the angle is the easiest I've found.

--- End quote ---

Have an old script that does just that.


--- Quote from: screenShake ---///screenShake(time,shakeX,shakeY)
//
//  shakes the screen for an amount of time
//
//      time        the time to shake
//      shakeX      the maximum shaking intensity in x axis(pixel)
//      shakeY      the maximum shaking intensity in y axis(pixel)
//

{
    var inst;
    inst = instance_create(view_xview[0],view_yview[0],objScreenShake);
    inst.alarm[0] = argument0;
    inst.shakeX = argument1;
    inst.shakeY = argument2;
}
--- End quote ---

and it creates an object that actually shakes the view.

objScreenShake:


--- Quote from: Create Event: ---{
    //get the x,y value of current view
    xview=view_xview[0];
    yview=view_yview[0];
}

--- End quote ---


--- Quote from: Alarm 0: ---{
    //restoring original views
    view_xview[0]=xview;
    view_yview[0]=yview;
    instance_destroy();
}

--- End quote ---


--- Quote from: Step Event: ---{
    //shaking views
    view_xview[0]=xview+random_range(-shakeX,shakeX);
    view_yview[0]=yview+random_range(-shakeY,shakeY);
}

--- End quote ---

Basically you sohuldn't be using this more than once at a time; Otherwise the view in the actual room will be restored to an angle that be off from the actual window.

Navigation

[0] Message Index

[*] Previous page

Go to full version