Main Menu

Twinkle, Twinkle Little Star

Started by geecee, April 28, 2009, 12:53:57 AM

Previous topic - Next topic

geecee

Hi there!

Here's another short programme that I converted from one that appeared in an old computer magazine.  The conversion wasn't difficult but I've spruced it up a little.

All it does really is fill your screen with stars ...... Anyway

PlayBASIC Code: [Select]
; PROJECT : Twinkle, Twinkle Little star
; AUTHOR : geecee
; CREATED : 28/04/2009
; EDITED : 28/04/2009
rem ---------------------------------------------------------------------

rem Load the "Arial" font as font 2, size 24, in bold style
LoadFont "Arial",2,24,1

rem Set font
setfont 2

rem This command will hide mouse pointer
mouse off

rem Determine maximum twinkle times
max=rnd(50)

rem set ink colour
ink rgb(255,217,128)

rem Write ctext to screen
centertext 400,20, "The stars will twinkle "+str$(max)+" times"

rem Continue until determined result is met
repeat

rem Increment the times counter
inc times

rem Draw a box to hide previous text at location
boxc 2,50,798,70,1,rgb(0,0,0)

rem Write ctext to screen
centertext 400,50,"Count = "+str$(times)

rem Display screen
sync

rem This is necessary to ensure that windows doesn't decide to move/alter our
rem screen/image memory while were drawing to it.
lockbuffer

rem Display stars in random colours at random locations
for i=1 to 500
ink rgb(rnd(255),rnd(255),rnd(255))
text 40+rnd(700),80+rnd(450),"*"
next i

rem Display screen
sync

rem Turn off the locking placed upon the current graphics buffer
unlockbuffer

until times=max

rem Write ctext to screen
centertext 400,550,"THE END"

rem Display screen
sync

rem A short wait before proceeding
wait 1000
wait 1000

rem End programme
end



:)
Enjoy
geecee
LANG MEY YER LUM REEK

A smile costs less than electricity and gives more light :)