The *image command is used to add images into the game.
Images can be added wherever you want. The simple version is:
*image wolf.png You found a wolf!
This will display the wolf.png image in your mygame game folder (..\web\mygame); if you do not have a wolf.png image, the image will not display and there will be no errors.
You can, for organizational purposes, create an images folder inside mygame to store your images. If you do this, you need to tell the command where to find your image:
Will display the wolf.png file stored in your images folder in the mygame folder (..\web\mygame\images).
ChoiceScript supports most image formats, the most common of which are:
- PNG - this format is the best choice for quality due to the lossless compression it uses. It also supports transparency.
- JPG - images in this format are compressed to a much smaller file size, and as a result, loose a bit of their quality. JPG images do not support transparency.
- BMP - images in this format are uncompressed, and therefore preserve the image's quality. Because they aren't compressed, they can be very large however.
- GIF - this format is similar to PNG as it supports transparency, but lacks the quality of a PNG file. Gif images can, however, be animated.
- Visual format comparison
The *image command takes care of the size of the image: images will automatically be sized down if the width of the image is larger than the width of the device used to play the game.
Images will never be sized up because that would cause the image to be stretched. It is best to insert a large, high-quality image that will be downsized.
But, what if you want the image to "stick" to a side of the screen? Here's what you do:
*image wolf.png left
*image wolf.png right
*image wolf.png center
These "left" and "right" will stick your image to a side of the screen, and the "center" will make your image stick in the center of the screen (if you do not, however, write any word, the image will stick to the center by default).
It is good practice to add alternate descriptive text associated with the image, which will be shown in case the image cannot be displayed for some reason. This is also very useful for visually impaired players who use a screen reader.
*image wolf.png center A lone, mangy wolf howling at the moonlight.
The text "A lone, mangy wolf howling at the moonlight." is not a caption and will not be displayed unless the image is unavailable.
Note: the alignment parameter must be set between the image source (wolf.png) and the alt text (A lone, mangy wolf howling at the moonlight.), otherwise it will throw an error. "None" is an acceptable alignment parameter if you do not wish to specify "left", "right" or "center".
|More commands / functions|
|Choice||*choice, *fake_choice, *disable_reuse, *hide_reuse, *allow_reuse, *selectable_if|
|Variable||*create, *temp, *set, Arithmetic operators, *delete, *input_number, *input_text, *print, *rand|
|Conditional||*if, *elseif, *else, Multireplace|
|Goto||*label, *goto, *goto_scene, *goto_random_scene, *gosub, *gosub_scene, *finish|
|Formatting||Bold text, Italic text, *image, *line_break, *page_break, *link, *stat_chart|
|Miscellaneous||*comment, *scene_list, *title, *author, *achieve, *achievement, *check_achievements, *bug, *ending, *more_games, *share_this_game, *show_password, *script, Implicit Control Flow|