A Blitz executable crashes, but works fine in the IDE.This problem is nearly always caused by one of these two errors...
Possible cause 1
The program can't find its external files (images, sounds, etc). Make sure that you're not using full pathnames for your files. For example, if your source code, rocketgame.bb, is stored in "C:\My Documents\RocketGame\" and your player image, rocket.bmp, is in "C:\My Documents\RocketGame\images\", like so...
... you only need to refer to "images\rocket.bmp", eg. LoadImage ("images\rocket.bmp"). This way, when you distribute your game contained in its "RocketGame" folder, the end user can place it anywhere on their hard drive and the game will still find its files. This is very important, as not everybody has their "My Documents" folder in "C:\My Documents\", for example.
If your game has its external files stored in sub-directories, make sure that the user has unarchived the game properly. WinZIP 8, for example, provides a checkbox titled 'Use folder names' in the Extract dialog. This must be checked in order to recreate the directory structure; otherwise, all of your files will be spewed out into the same folder, and therefore won't be found by your program. Other archivers will probably have a similar option, such as 'Use full paths'.
If you're a total beginner and all that seems too complicated, just put all your image and sound files in the same folder as the program's .bb source file, and refer to each file only by its filename, eg. LoadImage ("rocket.bmp"). Once you've created your executable, just put it in the same folder.
Possible cause 2
The program's screenmode has been 'hard-coded', meaning it uses a specific screenmode that another user's graphics card can't handle. The author should try leaving off the 'depth' parameter from the Graphics/Graphics3D command, and stick to common resolutions such as 640 x 480. Ideally, the programmer should present the user with a list of available screenmodes from the user's graphics card.
A simple list of available modes can be obtained like this:
For a = 1 to CountGfxModes ()
Print GfxModeWidth (a) + " x " + GfxModeHeight (a) + " @ " + GfxModeDepth (a) + "-bit"
Alternatively, just use GfxModeExists before calling Graphics if you absolutely insist on only providing one screenmode!
|Blitz Social Club|