Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Scrolling Tile Fade [PB SRC]

Author
Message
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 10th Feb 2008 23:40 Edited at: 12th Aug 2010 00:17
Scrolling Tile Fade

This example creates simple fading (in/out) scrolling tile effect. While the effect isn't particularly interesting, the approach is. The code uses a very common illusion from the old 8/16bit days of video games and demo's. The latter in particular are full of such visual illusions, where what you think is happening, virtually never is!

In this example the fading creates the illusion to the viewer that the entire 'screen' is fading in/out. While that is one (the most obvious) approach, but often same effect can be achieved by fading the elements in the scene, rather than the entire scene itself. (i.e. less pixels - less overhead = faster!)

So all this demo is doing, is loading the backdrop image as a tile. This image is stored as an FX image (so it can read quickly - this is important as it need to be dynamically changed). Then each redraw, we're using the BlitAlphaMultColour function from the BlitImage library to copy this image from it's original state (the original image never changes) onto a identically sized image that's stored in video memory. Once it's there, we can use the GPU to blit (tile) the chunks to the screen. And hey presto the illusion is complete.

Download
playbasic source codes

Get Source Code

Pic attached.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-05-06 14:09:57
Your offset time is: 2024-05-06 14:09:57