0% found this document useful (0 votes)
42 views11 pages

Lesson 6

The document discusses creating a screensaver program in Small Basic. It explains that a screensaver has moving objects on the screen indefinitely. It provides code examples to draw shapes like rectangles and circles, set random colors, and use a While loop to repeat the program indefinitely. The key aspects of a screensaver are that it displays moving objects continuously on the screen until stopped.

Uploaded by

api-373250983
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views11 pages

Lesson 6

The document discusses creating a screensaver program in Small Basic. It explains that a screensaver has moving objects on the screen indefinitely. It provides code examples to draw shapes like rectangles and circles, set random colors, and use a While loop to repeat the program indefinitely. The key aspects of a screensaver are that it displays moving objects continuously on the screen until stopped.

Uploaded by

api-373250983
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

LESSON 6: RANDOM NUMBERS FIRST STEPS IN SMALL

BASIC
OBJECTIVES
To use the RandomNumber function to generate random coordinates
To use the RandomColor function to get a random colour
To use a WhileEndWhile loop
SCREEN BURN
SCREENSAVERS
https://www.youtube.com/watch?v=6gMTYTDQLbM
MAKING A SCREENSAVER
A screensaver has moving objects on the screen
It continues indefinitely
DESIGN YOUR OWN SCREENSAVER!

What are the main requirements


of a screensaver?
DRAWING A RECTANGLE
To draw a rectangle you can use a statement like
GraphicsWindow.DrawRectangle(100, 100, 200,70)
To change the pen colour:
GraphicsWindow.PenColor ="Green

How will you draw a filled green square?


DRAWING FILLED SHAPES
We can easily draw and fill rectangles and ellipses without using the
turtle
To draw a red ellipse:
GraphicsWindow.BrushColor = Red GraphicsWindow.FillEllipse(XCoord,
YCoord, width,height)

How would you draw a blue circle with diameter 60?


RANDOMISING
To get a random colour, use a statement like

Colour = GraphicsWindow.GetRandomColor()
GraphicsWindow.BrushColor = Colour
USING A WHILEENDWHILE LOOP
To make a section of code repeat indefinitely, you can use a
While.Endwhile loop
'Make the program continue until the user presses End Program
ContinueForEver = "Yes"
While ContinueForEver = "Yes"
'insert program statements in here
EndWhile

You might also like