Peter's Homepage - Bugs! |
|||||||||
|
|||||||||
|
|
Creating your own bugsHere I will explain how you can create your own bugs. The bugs don't need to be bugs of course, they can be anything. Bugs consist out of two separate files: a bug file and an image file. Here I'll explain how these images should be created. It might also be useful to take a look at some bug files and images yourself. If an error occurs while reading a bug file or an image file, the screensaver will continue to operate, but the images might look messed up.
The bug fileThe bug file is simply a text file with bug as extension instead of txt. The bug file contains properties of the bug. The data must be separated by returns. The bug file consists out of the following elements: Image name Mouth distance Minimum distance around bug Here you can see how the distances are measured: This is an example of the contents of a bug file:
The image fileNote that using large images will slow the screensaver down mainly at starting up. Image file format Image layoutHere's an example of an image: The image file should contain two rows of images. The topmost row is the actual picture of the bug; the row beneath is the bug's mask. This mask will create transparency in combination with the bug images. The image file contains the separate bug images, which will form the animation. The bug's head should be pointing up (north). When the bug is walking forward, the animation will be made out of the images from left to right, starting at the leftmost image. After the rightmost image has been shown, the image sequence is reversed until the leftmost has been displayed. So if there are 3 images, the sequence is 1-2-3-2-1-2-... Bug and mask imagesTo create transparency, there should be a separate bug image and a mask image. (First the mask image is painted using an AND operation, then the mask is painted over it, using a PAINT operation.) The separate bug images should be square. For rotation purposes, only a circle with the radius equal to half the image width will be used. The rest will be ignored. So if you have bug images of 48x48 pixels, only the circle with the radius of 24 will be displayed. Only the image inside the circle will be displayed: The bug images are the normal images. The parts of the images that you want to be transparent must be black (0). The mask images generally consist only out of black and white. Black for the parts of the image that should be opaque, white for the transparent parts. (Note that using other colors will create some weird effects. Of course you're free to experiment.) |
||||||||