Type your ugBASIC program in the following box. Some BASIC rules:
  • keywords must be UPPERCASE, like PRINT
  • comments that are placed at the end of a line must be preceded by a colon:
    • this is good: PRINT "OK!": ' comment
    • this is wrong: PRINT "OK!" ' comment
Click on Build menu to select the target: you will download the compiled binary file!

' We suggest the use the most coloured ' resolution (up to 16 colors). BITMAP ENABLE(16) ' We clear the graphical screen. CLS ' Put the color border to BLACK (if border is present) COLOR BORDER BLACK ' Load from the host the (degrated quality of the) image ' of the opening titles of the videogame. ' ' Note that the original image has been converted to ' match at best each target, and moved the result into ' each folder with the same target name. In particular: ' ' atari / atarixl : 160x96 pixel, 4 colors ' c64 : 160x200 pixel, 16 colors ' coleco : 256x160 pixel, 16 colors titles := LOAD IMAGE("indiana_titles.png") ' Load from the host the (degrated quality of the) image ' of the animated sprites of the character. indiana := LOAD ATLAS("indiana_full.png") FRAME SIZE (32,64) ' Finally, load from the host the music track, in MIDI ' format. It will be converted to the native format, as well. music := LOAD MUSIC("indiana.mid") ' This is a parallel procedure, that is a procedure that ' will be played in a multitasking fashion. Infact, ' it will animate the characted indipendently from ' music and other tasks. PARALLEL PROCEDURE animateIndiana ' Let graphical resource of indiana character ' be accessible inside this procedure. SHARED indiana ' This is the current frame to show. DIM frame AS BYTE ' Start from the first frame. frame = 0 PUT IMAGE indiana FRAME frame AT 0, SCREEN HEIGHT - IMAGE HEIGHT(indiana) ' Wait a random time to animate. WAIT 4000*(1+RND(3)) MS ' Repeat the animation forever. DO ' Draw a frame on the screen. The character will be ' drawn at the bottom left of the screeen. The height ' of the screen and of the image are calculated at ' compile time. PUT IMAGE indiana FRAME frame AT 0, SCREEN HEIGHT - IMAGE HEIGHT(indiana) ' Wait some time, to avoid a too fast animation. WAIT 80 MS ' Move to the next frame. INC frame ' If animation is finished... IF frame = ( FRAMES(indiana) - 1 ) THEN ' ... let start from the beginning, ' and we will wait for a random ' time, in order to make a more ' natural animation. frame = 0 WAIT 4000*(2+RND(3)) MS ENDIF LOOP END PROCEDURE ' Let start the music! MUSIC music ' Put the titles on the screen! PUT IMAGE titles AT 0, 0 ' Start animation! SPAWN animateIndiana ' The program finishes here, and it does ' nothing, but it could do anything else, ' as long as RUN PARALLEL is called.
Learn to Write (Retro)Videogames! new

Welcome to the ugBASIC sandbox!

This tool was designed to quickly test whether the code you are writing compiles correctly and determines the desired results. Since the source is compiled thanks to dedicated servers, separate from the browser you are using, some commands are not available: for example, you cannot load external files or resources by using the LOAD command. If you need to develop a program with a complete tool, we recommend installing the executables or the UGBASIC-IDE.

Unless required by applicable law or agreed to in writing, this website is given on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.