Peter's Homepage - Bugs!

 
Home All programs Puac Bugs! TerraPainter Image gallery Contact

 

Bugs!
Download
Create bugs

 

Creating your own bugs

Here 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 file

The 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
The image name is the name of the image that contains the bug pictures. The image name is the relative path name of the image with the extension. The image can only be in the same directory as the bug file or in a sub-directory. Examples: Beetle.bmp or Bugs/Beetle.bmp. More information on the image can be found in the section 'The bug image file'.

Mouth distance
The mouth distance is the number of pixels between the center of a bug image and the position of the bug's mouth.

Minimum distance around bug
The minimum distance is the radius in pixels of a circle around the center of the bug. If this imaginary circle overlaps the circle of another bug, a 'collision' is detected.

Here you can see how the distances are measured:

distances

This is an example of the contents of a bug file:

DefaultBug.gif
20
25

 

The image file

Note that using large images will slow the screensaver down mainly at starting up.

Image file format
The following formats are supported: bmp, dib, jpg, gif, wmf, emf, ico and cur. Note that transparency in formats as gif or ico is lost. Transparency must be created by the mask images. Also note that a format like jpg has lower quality.

Image layout

Here's an example of an image:

default bug

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 images

To 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:

rotation circle

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.)

 

counter
Validate
Validate