Example template for 2D games

BlitzMax Forums/BlitzMax Beginners Area/Example template for 2D games

BlitzSupport(Posted 2004) [#1]
Example template for a 2D game:

Graphics 640, 480

image = LoadImage ("rocket.png")

Repeat

	Cls

	DrawImage image, MouseX (), MouseY ()

	Flip

Until KeyHit (KEY_ESCAPE)

End


This example opens a 640 x 480 display, loads an image and assigns it to the image variable. The Repeat/Until loop clears the screen each frame, draws the image to a hidden display area called the 'back buffer', and 'flips' the result into view. (All drawing operations automatically work on the back buffer in BlitzMax.) Pressing Esc ends the program.