Dibujar estrellas con el Mouse, Disparar un Cohete


 '--------------------------------

'- Variable declaration section -

'--------------------------------


Const WHITE = _RGB32(255, 255, 255) ' define color white


'----------------

'- Main program -

'----------------


Screen _NewImage(640, 480, 32) '                        initiate graphics screen

DIrections '                                            print directions

Do '                                                    begin main program loop

    _Limit 60 '                                         limit to 60 frames per second

    While _MouseInput: Wend '                           get latest mouse information

    If _MouseButton(1) Then DrawStar _MouseX, _MouseY ' if left button then draw star at pointer location

    If _MouseButton(2) Then DIrections '                if right button then clear the screen

    _Display '                                          update the screen with changes

Loop Until _KeyDown(27) '                               leave main loop when ESC pressed

System '                                                return control to OS


'---------------------------------------------------------------------------------------------------------------

Sub DIrections ()

    '-----------------------------------------------------------------------------------------------------------

    '- Clear the screen then print directions -

    '------------------------------------------


    Cls '                                             clear the screen

    Print '                                           print directions

    Print " Left click anywhere on the screen to draw a star."

    Print " Right click to clear the screen."

    Print " Press the ESC key to exit the program."


End Sub


'---------------------------------------------------------------------------------------------------------------

Sub DrawStar (x%, y%)

    '-----------------------------------------------------------------------------------------------------------

    '- Draw a star at coordinate provided -

    '-                                    -

    '- x% - x location to draw star       -

    '- y% - y location to draw star       -

    '--------------------------------------


    Line (x% - 10, y% - 3)-(x% + 10, y% - 3), WHITE ' draw a solid star

    Line -(x% - 7, y% + 7), WHITE

    Line -(x%, y% - 10), WHITE

    Line -(x% + 7, y% + 7), WHITE

    Line -(x% - 10, y% - 3), WHITE

    Paint (x%, y%), WHITE, WHITE

    Paint (x% - 5, y% - 1), WHITE, WHITE

    Paint (x% + 5, y% - 1), WHITE, WHITE

    Paint (x%, y% - 4), WHITE, WHITE

    Paint (x% - 3, y% + 3), WHITE, WHITE

    Paint (x% + 3, y% + 3), WHITE, WHITE


End Sub


Cohete
'--------------------------------
'- Variable declaration section -
'--------------------------------

DIM CountDown% ' the count down timer
DIM LiftOff% '   lift off sequence counter

'----------------------------
'- Main program begins here -
'----------------------------

PRINT "Rocket launch in T minus ..."
FOR CountDown% = 10 TO 0 STEP -1
    SLEEP 1
    PRINT
    PRINT CountDown%; "..."
    IF CountDown% = 3 THEN
        PRINT
        PRINT "We have engine ignition ..."
    END IF
NEXT CountDown%
PRINT
PRINT "and lift-off ... !"
SLEEP 1
PRINT
_DELAY .1
PRINT " /\"
_DELAY .1
PRINT " ||"
_DELAY .1
PRINT " ||"
_DELAY .1
PRINT " ||"
_DELAY .1
PRINT "/||\"
_DELAY .1
PRINT "-||-"
_DELAY .1
PRINT " ^^"
_DELAY .1
FOR LiftOff% = 1 TO 25
    _DELAY .1
    PRINT
NEXT LiftOff%
SYSTEM