![]() We have drawn lines from each coordinate to another.If it movement in only one direction was wished, we had to set the increment only in one variable. This allows the box to be drawn on a new position rather than the same one. We have set an increment of the coordinates.This enables the animation to run until the user ends it by pressing a key. We have called the sub which creates the animation.We have switched from the default qbasic text-only screen to one which enables graphics.SCREEN 7 ' we need to use a graphics enabled screen mode animation 'calling the sub SUB animation SCREEN 7 x = 10 'set first x- coordinate y = 10 'set first y-coordinate DO CLS ' going back to a blank screen so that the previous rectangle is erased x = x + 3 ' setting increment of coordinate x y = y + 3 ' setting increment of coordinate y LINE ( x, y ) - ( x + 5, y ) 'drawing lines LINE ( x, y + 5 ) - ( x + 5, y + 5 ) LINE ( x, y ) - ( x, y + 5 ) LINE ( x + 5, y ) - ( x + 5, y + 5 ) SLEEP 2 LOOP UNTIL INKEY$ "" END SUB ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |