Graphics 800,600 rot#=0.0 Repeat Cls SetRotation rot DrawRect 200,200,100,100 rot=rot+1.0 If rot>360.0 Then rot=rot-360.0 Flip FlushMem() Until KeyHit(KEY_ESCAPE)
There you go mate. Welcome to Blitz!
Your program always starts with a graphics command to open a screen - here we opened in 800 by 600 pixel mode. The repeat/until command loop until the user presses the escape key. Everything inside this is indented to make it easy to see that it's running inside a loop (you don't have to indent, but it helps readability.) We declare a variable rot to hold the angle of rotation of the rectangle. The # on the end tells Blitz the variable is a floating point number (a number that can hold fractional values). Every loop, we clear the screen, set the required rotation and draw the rectangle. rot is increased by 1 every loop to change the rotation. Flip flips the screen - all drawing is done on a second copy of the screen called the backbuffer that is not visible to the user. When flip is called, this is brought to the front so you can see the results. Always stick flushmem() once in your main loop - although it probably isnt required here. Try changing the rotation speed and the size of the rectangle. Look up the loadimage and drawimage commands and try to get the example rotating an image.