View RSS Feed

Visual Effects

Shaking the screen or what is Viewport

Rate this Entry
So, hello everyone and this is my first post on how to add effects to your game.
Necessary things
• Extension called "Viewport". You can download it from Extension manager.
• Two alterable values. The first will be called Time, and the second Coefficient.
Start
• 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.
Click image for larger version. 

Name:	Game Laser Shoot with Blur.png 
Views:	13 
Size:	11.1 KB 
ID:	22697
• 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.
Some visualisations
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.
What for?
If you do this, the Blur effect will be created during shaking.
The end
And on this first post in my blog ends. Write comments if you have any wishes, for example, more explanations or screenshots, etc.
See you!
Categories
Uncategorized

Comments