Shaking the screen or what is Viewport
by, 9th April 2017 at 08:35 AM (365 Views)
So, hello everyone and this is my first post on how to add effects to your game.
Extension called "Viewport". You can download it from Extension manager.
Two alterable values. The first will be called Time, and the second Coefficient.
Add those alterable values to Viewport. Time is the time during which the screen will shake. Coefficient - the power of shaking (in pixels). Set the value as you want.
Resize Viewport to the size of the game.
Add the 1st event → Start of frame → Viewport: Set source region (top-left) → X=0 → Y=0 → Frame Width → Frame Height.
Add the 2nd event → Upon pressing "spacebar" → Viewport: Set Time to 30 (Set the value as you want).
Add the 3rd event → Viewport: Time > 0 → 1) Subtract from Time 1. 2) Set source region (top-left) → X=0+Random(Coefficient) → Y=0+Random(Coefficient) → Frame Width → Frame Height.
Add the 4th event → Viewport: Time = 0 → Viewport: Set source region (top-left) → X=0 → Y=0 → Frame Width → Frame Height.
If you want, you can add to 3rd event → Frame: Set alpha-blending coefficient → 127 and to 4th event → Frame: Set alpha-blending coefficient → 0.
If you do this, the Blur effect will be created during shaking.
And on this first post in my blog ends. Write comments if you have any wishes, for example, more explanations or screenshots, etc.