TGC Codebase Backup



Screenshots by master programmer

25th Jul 2005 22:14
Summary

This code lets you take screenshots of your game for various uses within the game, such as screenshots of player-built tracks or player-created characters.



Description

This code lets the user take a screenshot of any part of your game while in the do loop commands. This allows the player to press "p" to take a screenshot of whatever is on screen. Thus, creating a picture of a playcr-created character, track, or whatever needs doing. In the forums, I've noticed a lot of different people asking questions about taking screenshots like GTA: San Andreas, or racing games. I've supplied this code numerous times, but I believe putting it here will have a greater effecst.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    rem Taking Screenshots********
if inkey$()="p"
   `start of shottaking task
   _screenshots:
   `set variables
   screenshot$="screenshot"
   scdir$="screenshots/"
   jpg$=".jpg"
   inc scshot#,1

   `check file
   scshot$=str$(scshot#)
   if file exist(scdir$+screenshot$+scshot$+jpg$)=1 then gosub _screenshots

   `check path
   if path exist("screenshots")=0 then make directory "screenshots"
   `take shot and save
   save bitmap scdir$+screenshot$+scshot$+jpg$
endif