Search Tools Links Login

A Dash Thru the Woods

Visual Basic 6, or VB Classic

A Dash Through the Woods by Robert Rayment. UPDATE: Improved bitmap creation (Having been goaded by Paul) plus some simple sound. This prog is based on the triplet StretchDIBits, byte arrays and assembler (as with 'Tunnels & Things' which got 10 excellent votes) except I've left out the assembler which means that it MUST be compiled so that the array manipulations are again dealt with by machine code. The prog will only produce a large bitmap file of smaller trees from a starting bitmap ONCE so that later runs can load up the byte arrays quickly. The creation of the bit maps is fast enough now so you could leave out the save to disk if you wanted to. It shows some other uses for StretchDIBits and 8-bit color byte surfaces, which might be of interest to some of you. No assembler is used. Trees are then put onto a drawing surface starting with the smallest and ignoring a white surround (masks not needed). By keeping and adjusting the x-position, direction and type of tree it looks like moving through some woods. Timing (using GetTickCount) and hence speed, the number of tree starts and their spread are on an options menu. The left & right cursor moves a little car to the left & right (actually the trees move in the opposite direction) and the up & down cursor changes the speed. You have to try not to hit the trees. Collision detection is based on x-coords. It needs compiling to an EXE to get a decent speed. Don't expect DirectX quality but I think its fun! The Zip file is 54 KB.

Original Author: Robert Rayment


Nothing special



Side Effects

Produces a binary bitmap file once

API Declarations

StretchDIBits plus a couple

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 123 times


Visual Basic 6

Posted: 9/3/2020 3:45:00 PM
Size: 55,663 bytes

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.