
-----------------------------------
Nablo
Mon Dec 19, 2011 4:53 pm

Need Help with Collision and Screen Flickering
-----------------------------------
What is it you are trying to achieve?



What is the problem you are having?
Screen Flickers too much due to the nature of the way I generated the bullets.
Collision with edge of screen not working. Boot collision with the black part of the portal doesnt work


Describe what you have tried to solve this problem
Tried using various types of arrays and configurations with arrays to help with the bullet problem. Tried moving the View.Update to various sensible places in the program. Tried using only one view.update (which didnt work).


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
My game :)



% Declare Variables

var CXBLSSBbody, CYBLSSBbody, CXTRSSBbody, CYTRSSBbody, CXSBarm, CYSBarm, CXRSBarm, CYRSBarm, CXSBfan, CYSBfan, CXRSBfan : int
var CYRSBfan, CXBLSSBhead, CYBLSSBhead, CXTRSSBhead, CYTRSSBhead, CXBLSSBleftleg, CYBLSSBleftleg, CXTRSSBleftleg : int
var CYTRSSBleftleg, CXBLSSBrightleg, CYBLSSBrightleg, CXTRSSrightleg, CYTRSSBrightleg, CXBLSSBleftshoe, CYBLSSBleftshoe : int
var CXTRSSBleftshoe, CYTRSSBleftshoe, CXBLSSBrightshoe, CYBLSSBrightshoe, CXTRSSrightshoe, CYTRSSBrightshoe : int
var CXSBlefteye, CYSBlefteye, CXRSBlefteye, CYRSBlefteye, CXSBrighteye, CYSBrighteye, CXRSBrighteye, CYRSBrighteye : int
var CXBLP, CYBLP, CXRSBbiglandingpad, CYRBLP, CXSLP, CYSLP, CXRSLP, CYRSLP, CXESbody, CYESbody, CXRESbody, CYRESbody : int
var CX1ESspiketopleft, CX2ESspiketopleft, XY1ESspiketopleft, CY2spiketopleft, CX1ESspiketopright, CX2ESspiketopright : int
var XY1ESspiketopright, CY2spiketopright, CX1ESspikebottomleft, CX2ESspikebottomleft, XY1ESspikebottomleft : int
var CY2spikebottomleft, CX1ESspikebottomright, CX2ESspikebottomright, XY1ESspikebottomright, CY2spikebottomright : int
var CX1ESspikeleftleft, CX2ESspikeleftleft, XY1ESspikeleftleft, CY2spikeleftleft, CX1ESspikeleftright : int
var CX2ESspikeleftright, XY1ESspikeleftright, CY2spikeleftright, CX1ESspikerightleft, CX2ESspikerightleft : int
var XY1ESspikerightleft, CY2spikerightleft, CX1ESspikerightright, CX2ESspikerightright, XY1ESspikerightright : int
var CY2spikerightright, CXBLSP, CYBLSP, CXTRSP, CYTRSP, CXB, CYB, CXRB, CYRB, CXBLSBH, CYBLSBH, CXTRSBH, CYTRSBH : int
var life, speed : int
var ch : string (1)


% Assign Values to Big Landing Pad

CXBLP := 50
CYBLP := 0
CXRSBbiglandingpad := 50
CYRBLP := 15

% Assign Values to Small Landing Pad

CXSLP := 50
CYSLP := 0
CXRSLP := 25
CYRSLP := 7

% Assign Values to Portal

CXBLSP := 600
CYBLSP := 0
CXTRSP := 640
CYTRSP := 150

% Assign Values to Blaster

CXB := 640
CYB := 250
CXRB := 100
CYRB := 25

% Assign Values to Black Hole

CXBLSBH := (maxx div 2) - 125
CYBLSBH := 0
CXTRSBH := (maxx div 2) + 125
CYTRSBH := 300


process Grid

    for x : 1 .. 640 by 20
        for y : 1 .. 420 by 20
            drawbox (x, y, x + 20, y + 20, black)
        end for
    end for

end Grid

process ParticleGenerationScrapBoy

    View.Set ("offscreenonly")

    var a : int := 1
    var xe, ye : array 1 .. a + 1 of int
    var speed : int := 1

    a += 1
    xe (a) := CXRSBarm
    ye (a) := CYSBarm + ((CYRSBarm - CYSBarm) div 2)

    loop

        drawfilloval (xe (a), ye (a), 10 + 3, 10 + 3, white)

        % Draw BG

        drawfillbox (0, 0, maxx, maxy, gray)

        % Draw Landing Pad
        drawfilloval (CXBLP, CYBLP, CXRSBbiglandingpad, CYRBLP, 25)
        drawfilloval (CXSLP, CYSLP, CXRSLP, CYRSLP, 12)

        % Draw Robot

        drawfillbox (CXSBarm - 2, CYSBarm - 2, CXRSBarm + 2, CYRSBarm + 2, black)
        drawfillbox (CXSBarm, CYSBarm, CXRSBarm, CYRSBarm, 122)
        drawfillbox (CXBLSSBbody - 1, CYBLSSBbody - 1, CXTRSSBbody + 1, CYTRSSBbody + 1, black)
        drawfillbox (CXBLSSBbody, CYBLSSBbody, CXTRSSBbody, CYTRSSBbody, 92)
        drawfilloval (CXSBfan, CYSBfan, CXRSBfan + 2, CYRSBfan + 2, black)
        drawfilloval (CXSBfan, CYSBfan, CXRSBfan, CYRSBfan, 13)
        drawfillbox (CXBLSSBhead - 2, CYBLSSBhead - 2, CXTRSSBhead + 2, CYTRSSBhead + 2, black)
        drawfillbox (CXBLSSBhead, CYBLSSBhead, CXTRSSBhead, CYTRSSBhead, 54)
        drawfillbox (CXBLSSBleftleg, CYBLSSBleftleg, CXTRSSBleftleg, CYTRSSBleftleg, 81)
        drawfillbox (CXBLSSBrightleg, CYBLSSBrightleg, CXTRSSrightleg, CYTRSSBrightleg, 81)
        drawfillbox (CXBLSSBleftshoe - 1, CYBLSSBleftshoe - 1, CXTRSSBleftshoe + 1, CYTRSSBleftshoe + 1, black)
        drawfillbox (CXBLSSBleftshoe, CYBLSSBleftshoe, CXTRSSBleftshoe, CYTRSSBleftshoe, 51)
        drawfillbox (CXBLSSBrightshoe - 1, CYBLSSBrightshoe + -1, CXTRSSrightshoe + 1, CYTRSSBrightshoe + 1, black)
        drawfillbox (CXBLSSBrightshoe, CYBLSSBrightshoe, CXTRSSrightshoe, CYTRSSBrightshoe, 51)
        drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye, CYRSBlefteye, 12)
        drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye, CYRSBrighteye, 12)
        drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye - 3, CYRSBlefteye - 3, black)
        drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye - 3, CYRSBrighteye - 3, black)
        drawfilloval (CXSBlefteye + 2, CYSBlefteye + 2, CXRSBlefteye - 5, CYRSBlefteye - 5, white)
        drawfilloval (CXSBrighteye + 2, CYSBrighteye + 2, CXRSBrighteye - 5, CYRSBrighteye - 5, white)

        % Draw Portal
        drawfillbox (CXBLSP, CYBLSP, CXTRSP, CYTRSP, blue)

        % Draw Blaster
        drawfilloval (CXB, CYB, CXRB, CYRB, 122)

        %Draw Black Hole

        drawfillbox (CXBLSBH - 10, CYBLSBH, CXTRSBH + 10, CYTRSBH + 10, purple)
        drawfillbox (CXBLSBH, CYBLSBH, CXTRSBH, CYTRSBH, black)

        xe (a) := xe (a) + speed

        drawfilloval (xe (a), ye (a), 10 + 3, 10 + 3, yellow)
        drawfilloval (xe (a), ye (a), 10, 10, red)
        put life

        View.Update

        exit when xe (a) = maxx + 100
    end loop
end ParticleGenerationScrapBoy

process ParticleGenerationBlaster

    View.Set ("offscreenonly")

    var xp, yp : array 1 .. 6 of int
    var speed : int := 1

    xp (1) := CXB - 100
    yp (1) := CYB
    xp (2) := CXB - 100
    yp (2) := CYB

    loop

        drawfilloval (xp (1), yp (1), 10 + 3, 10 + 3, white)
        drawfilloval (xp (2), yp (2), 10 + 3, 10 + 3, white)

        % Draw BG

        drawfillbox (0, 0, maxx, maxy, gray)

        % Draw Landing Pad
        drawfilloval (CXBLP, CYBLP, CXRSBbiglandingpad, CYRBLP, 25)
        drawfilloval (CXSLP, CYSLP, CXRSLP, CYRSLP, 12)

        % Draw Robot

        drawfillbox (CXSBarm - 2, CYSBarm - 2, CXRSBarm + 2, CYRSBarm + 2, black)
        drawfillbox (CXSBarm, CYSBarm, CXRSBarm, CYRSBarm, 122)
        drawfillbox (CXBLSSBbody - 1, CYBLSSBbody - 1, CXTRSSBbody + 1, CYTRSSBbody + 1, black)
        drawfillbox (CXBLSSBbody, CYBLSSBbody, CXTRSSBbody, CYTRSSBbody, 92)
        drawfilloval (CXSBfan, CYSBfan, CXRSBfan + 2, CYRSBfan + 2, black)
        drawfilloval (CXSBfan, CYSBfan, CXRSBfan, CYRSBfan, 13)
        drawfillbox (CXBLSSBhead - 2, CYBLSSBhead - 2, CXTRSSBhead + 2, CYTRSSBhead + 2, black)
        drawfillbox (CXBLSSBhead, CYBLSSBhead, CXTRSSBhead, CYTRSSBhead, 54)
        drawfillbox (CXBLSSBleftleg, CYBLSSBleftleg, CXTRSSBleftleg, CYTRSSBleftleg, 81)
        drawfillbox (CXBLSSBrightleg, CYBLSSBrightleg, CXTRSSrightleg, CYTRSSBrightleg, 81)
        drawfillbox (CXBLSSBleftshoe - 1, CYBLSSBleftshoe - 1, CXTRSSBleftshoe + 1, CYTRSSBleftshoe + 1, black)
        drawfillbox (CXBLSSBleftshoe, CYBLSSBleftshoe, CXTRSSBleftshoe, CYTRSSBleftshoe, 51)
        drawfillbox (CXBLSSBrightshoe - 1, CYBLSSBrightshoe + -1, CXTRSSrightshoe + 1, CYTRSSBrightshoe + 1, black)
        drawfillbox (CXBLSSBrightshoe, CYBLSSBrightshoe, CXTRSSrightshoe, CYTRSSBrightshoe, 51)
        drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye, CYRSBlefteye, 12)
        drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye, CYRSBrighteye, 12)
        drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye - 3, CYRSBlefteye - 3, black)
        drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye - 3, CYRSBrighteye - 3, black)
        drawfilloval (CXSBlefteye + 2, CYSBlefteye + 2, CXRSBlefteye - 5, CYRSBlefteye - 5, white)
        drawfilloval (CXSBrighteye + 2, CYSBrighteye + 2, CXRSBrighteye - 5, CYRSBrighteye - 5, white)

        % Draw Portal
        drawfillbox (CXBLSP, CYBLSP, CXTRSP, CYTRSP, blue)

        % Draw Blaster
        drawfilloval (CXB, CYB, CXRB, CYRB, 122)

        %Draw Black Hole

        drawfillbox (CXBLSBH - 10, CYBLSBH, CXTRSBH + 10, CYTRSBH + 10, purple)
        drawfillbox (CXBLSBH, CYBLSBH, CXTRSBH, CYTRSBH, black)

        xp (1) := xp (1) - speed
        xp (2) := xp (2) - speed

        drawfilloval (xp (1), yp (1), 10 + 3, 10 + 3, yellow)
        drawfilloval (xp (1), yp (1), 10, 10, red)

        if xp (1) = CXB - 200
                then
            drawfilloval (xp (2), yp (2), 10 + 3, 10 + 3, yellow)
            drawfilloval (xp (2), yp (2), 10, 10, red)
        end if
        put life

        View.Update

        if xp (1) = -10 then
            xp (1) := CXB - 100
        end if
        if xp (2) = -10 then
            xp (2) := CXB - 100
        end if
    end loop
end ParticleGenerationBlaster


setscreen ("graphics:640;480,nocursor")

for x1 : 1 .. 640 by 20
    for y1 : 1 .. 480 by 20
        drawbox (x1, y1, x1 + 20, y1 + 20, black)
    end for

    drawfillbox (0, 0, maxx, maxy, black)

end for
var arials, arialb, c : int
c := 66
arials := Font.New ("Arial:26:bold")
arialb := Font.New ("Arial:30:bold")
assert arials > 0
assert arialb > 0
Font.Draw ("The Adventures of Scrap Boy", 50, maxy - 50, arialb, yellow)


Font.Free (arials)

loop
    var x, y, button : int
    mousewhere (x, y, button)

    Font.Draw ("Play", 50, maxy - 150, arialb, c)
    if button = 0 and x > 50 and x < 130 and y > 320 and y < 356 then
        c := 94
    elsif
            button = 1 and x > 50 and x < 130 and y > 320 and y < 356 then

        cls

        % Assign Values to Scrap Boy's Right Shoe

        CXBLSSBrightshoe := 20
        CYBLSSBrightshoe := 0
        CXTRSSrightshoe := 45
        CYTRSSBrightshoe := 20

        % Assign Values to Scrap Boy's Left Shoe

        CXBLSSBleftshoe := 50
        CYBLSSBleftshoe := 0
        CXTRSSBleftshoe := 75
        CYTRSSBleftshoe := 20

        % Assign Values to Scrap Boy's Left Leg

        CXBLSSBleftleg := 25
        CYBLSSBleftleg := 20
        CXTRSSBleftleg := 40
        CYTRSSBleftleg := 24

        % Assign Values to Scrap Boy's Right Leg

        CXBLSSBrightleg := 55
        CYBLSSBrightleg := 20
        CXTRSSrightleg := 70
        CYTRSSBrightleg := 24

        % Assign Values to Scrap Boy's Body

        CXBLSSBbody := 15
        CYBLSSBbody := 25
        CXTRSSBbody := 80
        CYTRSSBbody := 65

        % Assign Values to Scrap Boy's Fan

        CXSBfan := 12
        CYSBfan := 45
        CXRSBfan := 5
        CYRSBfan := 10

        % Assign Values to Scrap Boy's Arm

        CXSBarm := 60
        CYSBarm := 55
        CXRSBarm := 100
        CYRSBarm := 65

        % Assign Values to Scrap Boy's Head

        CXBLSSBhead := 24
        CYBLSSBhead := 60
        CXTRSSBhead := 71
        CYTRSSBhead := 90

        % Assign Values to Scrap Boy's Left Eye

        CXSBlefteye := (CXTRSSBhead - CXBLSSBhead) - 10
        CYSBlefteye := 75
        CXRSBlefteye := 7
        CYRSBlefteye := 7

        % Assign Values to Scrap Boy's Right Eye

        CXSBrighteye := (CXTRSSBhead - CXBLSSBhead) + 10
        CYSBrighteye := 75
        CXRSBrighteye := 7
        CYRSBrighteye := 7



        % Assign Values to Life, Speed

        life := 4
        speed := 1


        fork Grid

        % Draw Landing Pad

        drawfilloval (CXBLP, CYBLP, CXRSBbiglandingpad, CYRBLP, 25)
        drawfilloval (CXSLP, CYSLP, CXRSLP, CYRSLP, 12)

        % Draw Robot

        drawfillbox (CXSBarm - 2, CYSBarm - 2, CXRSBarm + 2, CYRSBarm + 2, black)
        drawfillbox (CXSBarm, CYSBarm, CXRSBarm, CYRSBarm, 122)
        drawfillbox (CXBLSSBbody - 1, CYBLSSBbody - 1, CXTRSSBbody + 1, CYTRSSBbody + 1, black)
        drawfillbox (CXBLSSBbody, CYBLSSBbody, CXTRSSBbody, CYTRSSBbody, 92)
        drawfilloval (CXSBfan, CYSBfan, CXRSBfan + 2, CYRSBfan + 2, black)
        drawfilloval (CXSBfan, CYSBfan, CXRSBfan, CYRSBfan, 13)
        drawfillbox (CXBLSSBhead - 2, CYBLSSBhead - 2, CXTRSSBhead + 2, CYTRSSBhead + 2, black)
        drawfillbox (CXBLSSBhead, CYBLSSBhead, CXTRSSBhead, CYTRSSBhead, 54)
        drawfillbox (CXBLSSBleftleg, CYBLSSBleftleg, CXTRSSBleftleg, CYTRSSBleftleg, 81)
        drawfillbox (CXBLSSBrightleg, CYBLSSBrightleg, CXTRSSrightleg, CYTRSSBrightleg, 81)
        drawfillbox (CXBLSSBleftshoe - 1, CYBLSSBleftshoe - 1, CXTRSSBleftshoe + 1, CYTRSSBleftshoe + 1, black)
        drawfillbox (CXBLSSBleftshoe, CYBLSSBleftshoe, CXTRSSBleftshoe, CYTRSSBleftshoe, 51)
        drawfillbox (CXBLSSBrightshoe - 1, CYBLSSBrightshoe + -1, CXTRSSrightshoe + 1, CYTRSSBrightshoe + 1, black)
        drawfillbox (CXBLSSBrightshoe, CYBLSSBrightshoe, CXTRSSrightshoe, CYTRSSBrightshoe, 51)
        drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye, CYRSBlefteye, 12)
        drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye, CYRSBrighteye, 12)
        drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye - 3, CYRSBlefteye - 3, black)
        drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye - 3, CYRSBrighteye - 3, black)
        drawfilloval (CXSBlefteye + 2, CYSBlefteye + 2, CXRSBlefteye - 5, CYRSBlefteye - 5, white)
        drawfilloval (CXSBrighteye + 2, CYSBrighteye + 2, CXRSBrighteye - 5, CYRSBrighteye - 5, white)


        /*% Draw Evil Spikeria

         drawfilloval (CXESbody, CYESbody, CXRESbody, CYRESbody, red)
         drawline (CX1ESspiketopleft, CX2ESspiketopleft, XY1ESspiketopleft, CY2spiketopleft, black)
         drawline (CX1ESspiketopright, CX2ESspiketopright, XY1ESspiketopright, CY2spiketopright, black)
         drawline (CX1ESspikebottomleft, CX2ESspikebottomleft, XY1ESspikebottomleft, CY2spikebottomleft, black)
         drawline (CX1ESspikebottomright, CX2ESspikebottomright, XY1ESspikebottomright, CY2spikebottomright, black)
         drawline (CX1ESspikeleftleft, CX2ESspikeleftleft, XY1ESspikeleftleft, CY2spikeleftleft, black)
         drawline (CX1ESspikeleftright, CX2ESspikeleftright, XY1ESspikeleftright, CY2spikeleftright, black)
         drawline (CX1ESspikerightleft, CX2ESspikerightleft, XY1ESspikerightleft, CY2spikerightleft, black)
         drawline (CX1ESspikerightright, CX2ESspikerightright, XY1ESspikerightright, CY2spikerightright, black)*/

        % Draw Portal

        drawfillbox (CXBLSP, CYBLSP, CXTRSP, CYTRSP, blue)

        % Draw Blaster

        drawfilloval (CXB, CYB, CXRB, CYRB, 122)

        %Draw Black Hole

        drawfillbox (CXBLSBH - 10, CYBLSBH, CXTRSBH + 10, CYTRSBH + 10, purple)
        drawfillbox (CXBLSBH, CYBLSBH, CXTRSBH, CYTRSBH, black)

        %Movement for Scrap Boy

        setscreen ("graphics:640;480,nocursor")
        View.Set ("offscreenonly")

        fork ParticleGenerationBlaster

        loop

            % Draw BG

            drawfillbox (0, 0, maxx, maxy, gray)

            % Draw Landing Pad
            drawfilloval (CXBLP, CYBLP, CXRSBbiglandingpad, CYRBLP, 25)
            drawfilloval (CXSLP, CYSLP, CXRSLP, CYRSLP, 12)

            % Draw Portal
            drawfillbox (CXBLSP, CYBLSP, CXTRSP, CYTRSP, blue)

            % Draw Blaster
            drawfilloval (CXB, CYB, CXRB, CYRB, 122)

            %Draw Black Hole

            drawfillbox (CXBLSBH - 10, CYBLSBH, CXTRSBH + 10, CYTRSBH + 10, purple)
            drawfillbox (CXBLSBH, CYBLSBH, CXTRSBH, CYTRSBH, black)

            getch (ch)

            cls

            if ord (ch) = 32 then
                fork ParticleGenerationScrapBoy
            end if

            % BackgroundColour

            colourback (gray)

            % Draw BG

            drawfillbox (0, 0, maxx, maxy, gray)

            % Draw Landing Pad
            drawfilloval (CXBLP, CYBLP, CXRSBbiglandingpad, CYRBLP, 25)
            drawfilloval (CXSLP, CYSLP, CXRSLP, CYRSLP, 12)

            % Draw Robot

            drawfillbox (CXSBarm - 2, CYSBarm - 2, CXRSBarm + 2, CYRSBarm + 2, black)
            drawfillbox (CXSBarm, CYSBarm, CXRSBarm, CYRSBarm, 122)
            drawfillbox (CXBLSSBbody - 1, CYBLSSBbody - 1, CXTRSSBbody + 1, CYTRSSBbody + 1, black)
            drawfillbox (CXBLSSBbody, CYBLSSBbody, CXTRSSBbody, CYTRSSBbody, 92)
            drawfilloval (CXSBfan, CYSBfan, CXRSBfan + 2, CYRSBfan + 2, black)
            drawfilloval (CXSBfan, CYSBfan, CXRSBfan, CYRSBfan, 13)
            drawfillbox (CXBLSSBhead - 2, CYBLSSBhead - 2, CXTRSSBhead + 2, CYTRSSBhead + 2, black)
            drawfillbox (CXBLSSBhead, CYBLSSBhead, CXTRSSBhead, CYTRSSBhead, 54)
            drawfillbox (CXBLSSBleftleg, CYBLSSBleftleg, CXTRSSBleftleg, CYTRSSBleftleg, 81)
            drawfillbox (CXBLSSBrightleg, CYBLSSBrightleg, CXTRSSrightleg, CYTRSSBrightleg, 81)
            drawfillbox (CXBLSSBleftshoe - 1, CYBLSSBleftshoe - 1, CXTRSSBleftshoe + 1, CYTRSSBleftshoe + 1, black)
            drawfillbox (CXBLSSBleftshoe, CYBLSSBleftshoe, CXTRSSBleftshoe, CYTRSSBleftshoe, 51)
            drawfillbox (CXBLSSBrightshoe - 1, CYBLSSBrightshoe + -1, CXTRSSrightshoe + 1, CYTRSSBrightshoe + 1, black)
            drawfillbox (CXBLSSBrightshoe, CYBLSSBrightshoe, CXTRSSrightshoe, CYTRSSBrightshoe, 51)
            drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye, CYRSBlefteye, 12)
            drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye, CYRSBrighteye, 12)
            drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye - 3, CYRSBlefteye - 3, black)
            drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye - 3, CYRSBrighteye - 3, black)
            drawfilloval (CXSBlefteye + 2, CYSBlefteye + 2, CXRSBlefteye - 5, CYRSBlefteye - 5, white)
            drawfilloval (CXSBrighteye + 2, CYSBrighteye + 2, CXRSBrighteye - 5, CYRSBrighteye - 5, white)

            % Draw Portal
            drawfillbox (CXBLSP, CYBLSP, CXTRSP, CYTRSP, blue)

            % Draw Blaster
            drawfilloval (CXB, CYB, CXRB, CYRB, 122)

            %Draw Black Hole

            drawfillbox (CXBLSBH - 10, CYBLSBH, CXTRSBH + 10, CYTRSBH + 10, purple)
            drawfillbox (CXBLSBH, CYBLSBH, CXTRSBH, CYTRSBH, black)

            % Exit Condition

            exit when ord (ch) = 27

            % Movement Condition for Scrap Boy

            case ord (ch) of

                label 200 :
                    CYSBarm := CYSBarm + 5
                    CYBLSSBbody := CYBLSSBbody + 5
                    CYSBfan := CYSBfan + 5
                    CYBLSSBhead := CYBLSSBhead + 5
                    CYBLSSBleftleg := CYBLSSBleftleg + 5
                    CYBLSSBrightleg := CYBLSSBrightleg + 5
                    CYBLSSBleftshoe := CYBLSSBleftshoe + 5
                    CYBLSSBrightshoe := CYBLSSBrightshoe + 5
                    CYSBlefteye := CYSBlefteye + 5
                    CYSBrighteye := CYSBrighteye + 5
                    CYRSBarm := CYRSBarm + 5
                    CYTRSSBbody := CYTRSSBbody + 5
                    CYTRSSBhead := CYTRSSBhead + 5
                    CYTRSSBleftleg := CYTRSSBleftleg + 5
                    CYTRSSBrightleg := CYTRSSBrightleg + 5
                    CYTRSSBleftshoe := CYTRSSBleftshoe + 5
                    CYTRSSBrightshoe := CYTRSSBrightshoe + 5

                label 208 :
                    CYSBarm := CYSBarm - 5
                    CYBLSSBbody := CYBLSSBbody - 5
                    CYSBfan := CYSBfan - 5
                    CYBLSSBhead := CYBLSSBhead - 5
                    CYBLSSBleftleg := CYBLSSBleftleg - 5
                    CYBLSSBrightleg := CYBLSSBrightleg - 5
                    CYBLSSBleftshoe := CYBLSSBleftshoe - 5
                    CYBLSSBrightshoe := CYBLSSBrightshoe - 5
                    CYSBlefteye := CYSBlefteye - 5
                    CYSBrighteye := CYSBrighteye - 5
                    CYRSBarm := CYRSBarm - 5
                    CYTRSSBbody := CYTRSSBbody - 5
                    CYTRSSBhead := CYTRSSBhead - 5
                    CYTRSSBleftleg := CYTRSSBleftleg - 5
                    CYTRSSBrightleg := CYTRSSBrightleg - 5
                    CYTRSSBleftshoe := CYTRSSBleftshoe - 5
                    CYTRSSBrightshoe := CYTRSSBrightshoe - 5
                label 203 :
                    CXSBarm := CXSBarm - 5
                    CXBLSSBbody := CXBLSSBbody - 5
                    CXSBfan := CXSBfan - 5
                    CXBLSSBhead := CXBLSSBhead - 5
                    CXBLSSBleftleg := CXBLSSBleftleg - 5
                    CXBLSSBrightleg := CXBLSSBrightleg - 5
                    CXBLSSBleftshoe := CXBLSSBleftshoe - 5
                    CXBLSSBrightshoe := CXBLSSBrightshoe - 5
                    CXSBlefteye := CXSBlefteye - 5
                    CXSBrighteye := CXSBrighteye - 5
                    CXRSBarm := CXRSBarm - 5
                    CXTRSSBbody := CXTRSSBbody - 5
                    CXTRSSBhead := CXTRSSBhead - 5
                    CXTRSSBleftleg := CXTRSSBleftleg - 5
                    CXTRSSrightleg := CXTRSSrightleg - 5
                    CXTRSSBleftshoe := CXTRSSBleftshoe - 5
                    CXTRSSrightshoe := CXTRSSrightshoe - 5
                label 205 :
                    CXSBarm := CXSBarm + 5
                    CXBLSSBbody := CXBLSSBbody + 5
                    CXSBfan := CXSBfan + 5
                    CXBLSSBhead := CXBLSSBhead + 5
                    CXBLSSBleftleg := CXBLSSBleftleg + 5
                    CXBLSSBrightleg := CXBLSSBrightleg + 5
                    CXBLSSBleftshoe := CXBLSSBleftshoe + 5
                    CXBLSSBrightshoe := CXBLSSBrightshoe + 5
                    CXSBlefteye := CXSBlefteye + 5
                    CXSBrighteye := CXSBrighteye + 5
                    CXRSBarm := CXRSBarm + 5
                    CXTRSSBbody := CXTRSSBbody + 5
                    CXTRSSBhead := CXTRSSBhead + 5
                    CXTRSSBleftleg := CXTRSSBleftleg + 5
                    CXTRSSrightleg := CXTRSSrightleg + 5
                    CXTRSSBleftshoe := CXTRSSBleftshoe + 5
                    CXTRSSrightshoe := CXTRSSrightshoe + 5
                label :
                    CYSBarm := CYSBarm * 1

            end case

            drawfillbox (CXSBarm - 2, CYSBarm - 2, CXRSBarm + 2, CYRSBarm + 2, black)
            drawfillbox (CXSBarm, CYSBarm, CXRSBarm, CYRSBarm, 122)
            drawfillbox (CXBLSSBbody - 1, CYBLSSBbody - 1, CXTRSSBbody + 1, CYTRSSBbody + 1, black)
            drawfillbox (CXBLSSBbody, CYBLSSBbody, CXTRSSBbody, CYTRSSBbody, 92)
            drawfilloval (CXSBfan, CYSBfan, CXRSBfan + 2, CYRSBfan + 2, black)
            drawfilloval (CXSBfan, CYSBfan, CXRSBfan, CYRSBfan, 13)
            drawfillbox (CXBLSSBhead - 2, CYBLSSBhead - 2, CXTRSSBhead + 2, CYTRSSBhead + 2, black)
            drawfillbox (CXBLSSBhead, CYBLSSBhead, CXTRSSBhead, CYTRSSBhead, 54)
            drawfillbox (CXBLSSBleftleg, CYBLSSBleftleg, CXTRSSBleftleg, CYTRSSBleftleg, 81)
            drawfillbox (CXBLSSBrightleg, CYBLSSBrightleg, CXTRSSrightleg, CYTRSSBrightleg, 81)
            drawfillbox (CXBLSSBleftshoe - 1, CYBLSSBleftshoe - 1, CXTRSSBleftshoe + 1, CYTRSSBleftshoe + 1, black)
            drawfillbox (CXBLSSBleftshoe, CYBLSSBleftshoe, CXTRSSBleftshoe, CYTRSSBleftshoe, 51)
            drawfillbox (CXBLSSBrightshoe - 1, CYBLSSBrightshoe + -1, CXTRSSrightshoe + 1, CYTRSSBrightshoe + 1, black)
            drawfillbox (CXBLSSBrightshoe, CYBLSSBrightshoe, CXTRSSrightshoe, CYTRSSBrightshoe, 51)
            drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye, CYRSBlefteye, 12)
            drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye, CYRSBrighteye, 12)
            drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye - 3, CYRSBlefteye - 3, black)
            drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye - 3, CYRSBrighteye - 3, black)
            drawfilloval (CXSBlefteye + 2, CYSBlefteye + 2, CXRSBlefteye - 5, CYRSBlefteye - 5, white)
            drawfilloval (CXSBrighteye + 2, CYSBrighteye + 2, CXRSBrighteye - 5, CYRSBrighteye - 5, white)

            put life

            View.Update
            delay (10)

            %Colission with Border

            if CXRSBarm >= maxx and CXSBarm = maxy and CYSBarm = maxx and CXBLSSBbody = maxy and CYTRSSBbody = maxx and CXBLSSBhead = maxy and CYTRSSBhead = maxx and CXBLSSBleftleg = maxy and CYTRSSBleftleg = maxx and CXBLSSBrightleg = maxy and CYTRSSBrightleg = maxx and CXBLSSBleftshoe = maxy and CYTRSSBleftshoe = maxx and CXBLSSBrightshoe = maxy and CYTRSSBrightshoe = CXBLSBH and CXSBarm = CYBLSBH and CYSBarm = CXBLSBH and CXBLSSBbody = CYBLSBH and CYTRSSBbody = CXBLSBH and CXBLSSBhead = CYBLSBH and CYTRSSBhead = CXBLSBH and CXBLSSBleftleg = CYBLSBH and CYTRSSBleftleg = CXBLSBH and CXBLSSBrightleg = CYBLSBH and CYTRSSBrightleg = CXBLSBH and CXBLSSBleftshoe = CYBLSBH and CYTRSSBleftshoe = CXBLSBH and CXBLSSBrightshoe = CYBLSBH and CYTRSSBrightshoe = CXBLSBH and x1 = CYBLSBH and y1 = CXBLSBH and x1 = CYBLSBH and y1 = CXBLSBH and x1 = CYBLSBH and y1 >>4eef+1g2p4dde1f+2p")
        play ("2dc2d4pde2fefg4pf2g1a2p")
        play (">2f+4pc+f+g+2ag+f+e4pf+2e1c+")
        play ("dedd6f+df+a>df+a>df+dac2ddccf2f6d2f+1f+2p")
        play ("2e1ec+1e-")
        play ("c+e-ef+1bpp1c")
    end loop

end music

process Grid

    for x : 1 .. 640 by 20
        for y : 1 .. 420 by 20
            drawbox (x, y, x + 20, y + 20, black)
        end for
    end for

end Grid




setscreen ("graphics:640;480,nocursor")

for x1 : 1 .. 640 by 20
    for y1 : 1 .. 480 by 20
        drawbox (x1, y1, x1 + 20, y1 + 20, black)
    end for

    drawfillbox (0, 0, maxx, maxy, black)

end for
var arials, arialb, c : int
c := 66
arials := Font.New ("Arial:26:bold")
arialb := Font.New ("Arial:30:bold")
assert arials > 0
assert arialb > 0
Font.Draw ("The Adventures of Scrap Boy", 50, maxy - 50, arialb, yellow)


Font.Free (arials)

loop

    var x, y, button : int
    mousewhere (x, y, button)

    Font.Draw ("Play", 50, maxy - 150, arialb, c)
    if button = 0 and x > 50 and x < 130 and y > 320 and y < 356 then
        c := 94
    elsif
            button = 1 and x > 50 and x < 130 and y > 320 and y < 356 then

        cls

        fork Grid

        % Draw Landing Pad

        drawfilloval (CXBLP, CYBLP, CXRSBbiglandingpad, CYRBLP, 25)
        drawfilloval (CXSLP, CYSLP, CXRSLP, CYRSLP, 12)

        % Draw Robot

        drawfillbox (CXSBarm - 2, CYSBarm - 2, CXRSBarm + 2, CYRSBarm + 2, black)
        drawfillbox (CXSBarm, CYSBarm, CXRSBarm, CYRSBarm, 122)
        drawfillbox (CXBLSSBbody - 1, CYBLSSBbody - 1, CXTRSSBbody + 1, CYTRSSBbody + 1, black)
        drawfillbox (CXBLSSBbody, CYBLSSBbody, CXTRSSBbody, CYTRSSBbody, 92)
        drawfilloval (CXSBfan, CYSBfan, CXRSBfan + 2, CYRSBfan + 2, black)
        drawfilloval (CXSBfan, CYSBfan, CXRSBfan, CYRSBfan, 13)
        drawfillbox (CXBLSSBhead - 2, CYBLSSBhead - 2, CXTRSSBhead + 2, CYTRSSBhead + 2, black)
        drawfillbox (CXBLSSBhead, CYBLSSBhead, CXTRSSBhead, CYTRSSBhead, 54)
        drawfillbox (CXBLSSBleftleg, CYBLSSBleftleg, CXTRSSBleftleg, CYTRSSBleftleg, 81)
        drawfillbox (CXBLSSBrightleg, CYBLSSBrightleg, CXTRSSrightleg, CYTRSSBrightleg, 81)
        drawfillbox (CXBLSSBleftshoe - 1, CYBLSSBleftshoe - 1, CXTRSSBleftshoe + 1, CYTRSSBleftshoe + 1, black)
        drawfillbox (CXBLSSBleftshoe, CYBLSSBleftshoe, CXTRSSBleftshoe, CYTRSSBleftshoe, 51)
        drawfillbox (CXBLSSBrightshoe - 1, CYBLSSBrightshoe + -1, CXTRSSrightshoe + 1, CYTRSSBrightshoe + 1, black)
        drawfillbox (CXBLSSBrightshoe, CYBLSSBrightshoe, CXTRSSrightshoe, CYTRSSBrightshoe, 51)
        drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye, CYRSBlefteye, 12)
        drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye, CYRSBrighteye, 12)
        drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye - 3, CYRSBlefteye - 3, black)
        drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye - 3, CYRSBrighteye - 3, black)
        drawfilloval (CXSBlefteye + 2, CYSBlefteye + 2, CXRSBlefteye - 5, CYRSBlefteye - 5, white)
        drawfilloval (CXSBrighteye + 2, CYSBrighteye + 2, CXRSBrighteye - 5, CYRSBrighteye - 5, white)


        /*% Draw Evil Spikeria

         drawfilloval (CXESbody, CYESbody, CXRESbody, CYRESbody, red)
         drawline (CX1ESspiketopleft, CX2ESspiketopleft, XY1ESspiketopleft, CY2spiketopleft, black)
         drawline (CX1ESspiketopright, CX2ESspiketopright, XY1ESspiketopright, CY2spiketopright, black)
         drawline (CX1ESspikebottomleft, CX2ESspikebottomleft, XY1ESspikebottomleft, CY2spikebottomleft, black)
         drawline (CX1ESspikebottomright, CX2ESspikebottomright, XY1ESspikebottomright, CY2spikebottomright, black)
         drawline (CX1ESspikeleftleft, CX2ESspikeleftleft, XY1ESspikeleftleft, CY2spikeleftleft, black)
         drawline (CX1ESspikeleftright, CX2ESspikeleftright, XY1ESspikeleftright, CY2spikeleftright, black)
         drawline (CX1ESspikerightleft, CX2ESspikerightleft, XY1ESspikerightleft, CY2spikerightleft, black)
         drawline (CX1ESspikerightright, CX2ESspikerightright, XY1ESspikerightright, CY2spikerightright, black)*/

        % Draw Portal

        drawfillbox (CXBLSP, CYBLSP, CXTRSP, CYTRSP, blue)

        % Draw Blaster

        drawfilloval (CXB, CYB, CXRB, CYRB, 122)

        %Draw Black Hole

        drawfillbox (CXBLSBH - 10, CYBLSBH, CXTRSBH + 10, CYTRSBH + 10, purple)
        drawfillbox (CXBLSBH, CYBLSBH, CXTRSBH, CYTRSBH, black)

        %Movement for Scrap Boy

        setscreen ("graphics:640;480,nocursor")
        View.Set ("offscreenonly")

        %fork music

        loop

            % Draw BG

            drawfillbox (0, 0, maxx, maxy, gray)

            % Draw Landing Pad
            drawfilloval (CXBLP, CYBLP, CXRSBbiglandingpad, CYRBLP, 25)
            drawfilloval (CXSLP, CYSLP, CXRSLP, CYRSLP, 12)

            % Draw Portal
            drawfillbox (CXBLSP, CYBLSP, CXTRSP, CYTRSP, blue)

            % Draw Blaster
            drawfilloval (CXB, CYB, CXRB, CYRB, 122)

            %Draw Black Hole

            drawfillbox (CXBLSBH - 10, CYBLSBH, CXTRSBH + 10, CYTRSBH + 10, purple)
            drawfillbox (CXBLSBH, CYBLSBH, CXTRSBH, CYTRSBH, black)

            Input.KeyDown (chars)

            cls

            % BackgroundColour

            colourback (gray)

            % Draw BG

            drawfillbox (0, 0, maxx, maxy, gray)

            % Draw Landing Pad
            drawfilloval (CXBLP, CYBLP, CXRSBbiglandingpad, CYRBLP, 25)
            drawfilloval (CXSLP, CYSLP, CXRSLP, CYRSLP, 12)

            % Draw Robot

            drawfillbox (CXSBarm - 2, CYSBarm - 2, CXRSBarm + 2, CYRSBarm + 2, black)
            drawfillbox (CXSBarm, CYSBarm, CXRSBarm, CYRSBarm, 122)
            drawfillbox (CXBLSSBbody - 1, CYBLSSBbody - 1, CXTRSSBbody + 1, CYTRSSBbody + 1, black)
            drawfillbox (CXBLSSBbody, CYBLSSBbody, CXTRSSBbody, CYTRSSBbody, 92)
            drawfilloval (CXSBfan, CYSBfan, CXRSBfan + 2, CYRSBfan + 2, black)
            drawfilloval (CXSBfan, CYSBfan, CXRSBfan, CYRSBfan, 13)
            drawfillbox (CXBLSSBhead - 2, CYBLSSBhead - 2, CXTRSSBhead + 2, CYTRSSBhead + 2, black)
            drawfillbox (CXBLSSBhead, CYBLSSBhead, CXTRSSBhead, CYTRSSBhead, 54)
            drawfillbox (CXBLSSBleftleg, CYBLSSBleftleg, CXTRSSBleftleg, CYTRSSBleftleg, 81)
            drawfillbox (CXBLSSBrightleg, CYBLSSBrightleg, CXTRSSrightleg, CYTRSSBrightleg, 81)
            drawfillbox (CXBLSSBleftshoe - 1, CYBLSSBleftshoe - 1, CXTRSSBleftshoe + 1, CYTRSSBleftshoe + 1, black)
            drawfillbox (CXBLSSBleftshoe, CYBLSSBleftshoe, CXTRSSBleftshoe, CYTRSSBleftshoe, 51)
            drawfillbox (CXBLSSBrightshoe - 1, CYBLSSBrightshoe + -1, CXTRSSrightshoe + 1, CYTRSSBrightshoe + 1, black)
            drawfillbox (CXBLSSBrightshoe, CYBLSSBrightshoe, CXTRSSrightshoe, CYTRSSBrightshoe, 51)
            drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye, CYRSBlefteye, 12)
            drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye, CYRSBrighteye, 12)
            drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye - 3, CYRSBlefteye - 3, black)
            drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye - 3, CYRSBrighteye - 3, black)
            drawfilloval (CXSBlefteye + 2, CYSBlefteye + 2, CXRSBlefteye - 5, CYRSBlefteye - 5, white)
            drawfilloval (CXSBrighteye + 2, CYSBrighteye + 2, CXRSBrighteye - 5, CYRSBrighteye - 5, white)

            % Draw Portal
            drawfillbox (CXBLSP, CYBLSP, CXTRSP, CYTRSP, blue)

            % Draw Blaster
            drawfilloval (CXB, CYB, CXRB, CYRB, 122)

            %Draw Black Hole

            drawfillbox (CXBLSBH - 10, CYBLSBH, CXTRSBH + 10, CYTRSBH + 10, purple)
            drawfillbox (CXBLSBH, CYBLSBH, CXTRSBH, CYTRSBH, black)

            % Movement Condition for Scrap Boy

            if chars (KEY_UP_ARROW) then
                CYSBarm := CYSBarm + 5
                CYBLSSBbody := CYBLSSBbody + 5
                CYSBfan := CYSBfan + 5
                CYBLSSBhead := CYBLSSBhead + 5
                CYBLSSBleftleg := CYBLSSBleftleg + 5
                CYBLSSBrightleg := CYBLSSBrightleg + 5
                CYBLSSBleftshoe := CYBLSSBleftshoe + 5
                CYBLSSBrightshoe := CYBLSSBrightshoe + 5
                CYSBlefteye := CYSBlefteye + 5
                CYSBrighteye := CYSBrighteye + 5
                CYRSBarm := CYRSBarm + 5
                CYTRSSBbody := CYTRSSBbody + 5
                CYTRSSBhead := CYTRSSBhead + 5
                CYTRSSBleftleg := CYTRSSBleftleg + 5
                CYTRSSBrightleg := CYTRSSBrightleg + 5
                CYTRSSBleftshoe := CYTRSSBleftshoe + 5
                CYTRSSBrightshoe := CYTRSSBrightshoe + 5

            elsif chars (KEY_DOWN_ARROW) then
                CYSBarm := CYSBarm - 5
                CYBLSSBbody := CYBLSSBbody - 5
                CYSBfan := CYSBfan - 5
                CYBLSSBhead := CYBLSSBhead - 5
                CYBLSSBleftleg := CYBLSSBleftleg - 5
                CYBLSSBrightleg := CYBLSSBrightleg - 5
                CYBLSSBleftshoe := CYBLSSBleftshoe - 5
                CYBLSSBrightshoe := CYBLSSBrightshoe - 5
                CYSBlefteye := CYSBlefteye - 5
                CYSBrighteye := CYSBrighteye - 5
                CYRSBarm := CYRSBarm - 5
                CYTRSSBbody := CYTRSSBbody - 5
                CYTRSSBhead := CYTRSSBhead - 5
                CYTRSSBleftleg := CYTRSSBleftleg - 5
                CYTRSSBrightleg := CYTRSSBrightleg - 5
                CYTRSSBleftshoe := CYTRSSBleftshoe - 5
                CYTRSSBrightshoe := CYTRSSBrightshoe - 5

            elsif chars (KEY_LEFT_ARROW) then
                CXSBarm := CXSBarm - 5
                CXBLSSBbody := CXBLSSBbody - 5
                CXSBfan := CXSBfan - 5
                CXBLSSBhead := CXBLSSBhead - 5
                CXBLSSBleftleg := CXBLSSBleftleg - 5
                CXBLSSBrightleg := CXBLSSBrightleg - 5
                CXBLSSBleftshoe := CXBLSSBleftshoe - 5
                CXBLSSBrightshoe := CXBLSSBrightshoe - 5
                CXSBlefteye := CXSBlefteye - 5
                CXSBrighteye := CXSBrighteye - 5
                CXRSBarm := CXRSBarm - 5
                CXTRSSBbody := CXTRSSBbody - 5
                CXTRSSBhead := CXTRSSBhead - 5
                CXTRSSBleftleg := CXTRSSBleftleg - 5
                CXTRSSrightleg := CXTRSSrightleg - 5
                CXTRSSBleftshoe := CXTRSSBleftshoe - 5
                CXTRSSrightshoe := CXTRSSrightshoe - 5
            elsif chars (KEY_RIGHT_ARROW) then
                CXSBarm := CXSBarm + 5
                CXBLSSBbody := CXBLSSBbody + 5
                CXSBfan := CXSBfan + 5
                CXBLSSBhead := CXBLSSBhead + 5
                CXBLSSBleftleg := CXBLSSBleftleg + 5
                CXBLSSBrightleg := CXBLSSBrightleg + 5
                CXBLSSBleftshoe := CXBLSSBleftshoe + 5
                CXBLSSBrightshoe := CXBLSSBrightshoe + 5
                CXSBlefteye := CXSBlefteye + 5
                CXSBrighteye := CXSBrighteye + 5
                CXRSBarm := CXRSBarm + 5
                CXTRSSBbody := CXTRSSBbody + 5
                CXTRSSBhead := CXTRSSBhead + 5
                CXTRSSBleftleg := CXTRSSBleftleg + 5
                CXTRSSrightleg := CXTRSSrightleg + 5
                CXTRSSBleftshoe := CXTRSSBleftshoe + 5
                CXTRSSrightshoe := CXTRSSrightshoe + 5

            end if

            drawfillbox (CXSBarm - 2, CYSBarm - 2, CXRSBarm + 2, CYRSBarm + 2, black)
            drawfillbox (CXSBarm, CYSBarm, CXRSBarm, CYRSBarm, 122)
            drawfillbox (CXBLSSBbody - 1, CYBLSSBbody - 1, CXTRSSBbody + 1, CYTRSSBbody + 1, black)
            drawfillbox (CXBLSSBbody, CYBLSSBbody, CXTRSSBbody, CYTRSSBbody, 92)
            drawfilloval (CXSBfan, CYSBfan, CXRSBfan + 2, CYRSBfan + 2, black)
            drawfilloval (CXSBfan, CYSBfan, CXRSBfan, CYRSBfan, 13)
            drawfillbox (CXBLSSBhead - 2, CYBLSSBhead - 2, CXTRSSBhead + 2, CYTRSSBhead + 2, black)
            drawfillbox (CXBLSSBhead, CYBLSSBhead, CXTRSSBhead, CYTRSSBhead, 54)
            drawfillbox (CXBLSSBleftleg, CYBLSSBleftleg, CXTRSSBleftleg, CYTRSSBleftleg, 81)
            drawfillbox (CXBLSSBrightleg, CYBLSSBrightleg, CXTRSSrightleg, CYTRSSBrightleg, 81)
            drawfillbox (CXBLSSBleftshoe - 1, CYBLSSBleftshoe - 1, CXTRSSBleftshoe + 1, CYTRSSBleftshoe + 1, black)
            drawfillbox (CXBLSSBleftshoe, CYBLSSBleftshoe, CXTRSSBleftshoe, CYTRSSBleftshoe, 51)
            drawfillbox (CXBLSSBrightshoe - 1, CYBLSSBrightshoe + -1, CXTRSSrightshoe + 1, CYTRSSBrightshoe + 1, black)
            drawfillbox (CXBLSSBrightshoe, CYBLSSBrightshoe, CXTRSSrightshoe, CYTRSSBrightshoe, 51)
            drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye, CYRSBlefteye, 12)
            drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye, CYRSBrighteye, 12)
            drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye - 3, CYRSBlefteye - 3, black)
            drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye - 3, CYRSBrighteye - 3, black)
            drawfilloval (CXSBlefteye + 2, CYSBlefteye + 2, CXRSBlefteye - 5, CYRSBlefteye - 5, white)
            drawfilloval (CXSBrighteye + 2, CYSBrighteye + 2, CXRSBrighteye - 5, CYRSBrighteye - 5, white)


            %ParticleGenerationBlaster

            drawfilloval (xp (1), yp (1), 10 + 3, 10 + 3, white)
            drawfilloval (xp (2), yp (2), 10 + 3, 10 + 3, white)

            % Draw BG

            drawfillbox (0, 0, maxx, maxy, gray)

            % Draw Portal
            drawfillbox (CXBLSP, CYBLSP, CXTRSP, CYTRSP, blue)

            % Draw Blaster
            drawfilloval (CXB, CYB, CXRB, CYRB, 122)

            %Draw Black Hole

            drawfillbox (CXBLSBH - 10, CYBLSBH, CXTRSBH + 10, CYTRSBH + 10, purple)
            drawfillbox (CXBLSBH, CYBLSBH, CXTRSBH, CYTRSBH, black)

            % Draw Landing Pad
            drawfilloval (CXBLP, CYBLP, CXRSBbiglandingpad, CYRBLP, 25)
            drawfilloval (CXSLP, CYSLP, CXRSLP, CYRSLP, 12)

            % Draw Robot

            drawfillbox (CXSBarm - 2, CYSBarm - 2, CXRSBarm + 2, CYRSBarm + 2, black)
            drawfillbox (CXSBarm, CYSBarm, CXRSBarm, CYRSBarm, 122)
            drawfillbox (CXBLSSBbody - 1, CYBLSSBbody - 1, CXTRSSBbody + 1, CYTRSSBbody + 1, black)
            drawfillbox (CXBLSSBbody, CYBLSSBbody, CXTRSSBbody, CYTRSSBbody, 92)
            drawfilloval (CXSBfan, CYSBfan, CXRSBfan + 2, CYRSBfan + 2, black)
            drawfilloval (CXSBfan, CYSBfan, CXRSBfan, CYRSBfan, 13)
            drawfillbox (CXBLSSBhead - 2, CYBLSSBhead - 2, CXTRSSBhead + 2, CYTRSSBhead + 2, black)
            drawfillbox (CXBLSSBhead, CYBLSSBhead, CXTRSSBhead, CYTRSSBhead, 54)
            drawfillbox (CXBLSSBleftleg, CYBLSSBleftleg, CXTRSSBleftleg, CYTRSSBleftleg, 81)
            drawfillbox (CXBLSSBrightleg, CYBLSSBrightleg, CXTRSSrightleg, CYTRSSBrightleg, 81)
            drawfillbox (CXBLSSBleftshoe - 1, CYBLSSBleftshoe - 1, CXTRSSBleftshoe + 1, CYTRSSBleftshoe + 1, black)
            drawfillbox (CXBLSSBleftshoe, CYBLSSBleftshoe, CXTRSSBleftshoe, CYTRSSBleftshoe, 51)
            drawfillbox (CXBLSSBrightshoe - 1, CYBLSSBrightshoe + -1, CXTRSSrightshoe + 1, CYTRSSBrightshoe + 1, black)
            drawfillbox (CXBLSSBrightshoe, CYBLSSBrightshoe, CXTRSSrightshoe, CYTRSSBrightshoe, 51)
            drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye, CYRSBlefteye, 12)
            drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye, CYRSBrighteye, 12)
            drawfilloval (CXSBlefteye, CYSBlefteye, CXRSBlefteye - 3, CYRSBlefteye - 3, black)
            drawfilloval (CXSBrighteye, CYSBrighteye, CXRSBrighteye - 3, CYRSBrighteye - 3, black)
            drawfilloval (CXSBlefteye + 2, CYSBlefteye + 2, CXRSBlefteye - 5, CYRSBlefteye - 5, white)
            drawfilloval (CXSBrighteye + 2, CYSBrighteye + 2, CXRSBrighteye - 5, CYRSBrighteye - 5, white)

            xp (1) := xp (1) - speed
            xp (2) := xp (2) - speed

            drawfilloval (xp (1), yp (1), 10 + 3, 10 + 3, yellow)
            drawfilloval (xp (1), yp (1), 10, 10, red)

            if xp (1) = CXB - 200
                    then
                drawfilloval (xp (2), yp (2), 10 + 3, 10 + 3, yellow)
                drawfilloval (xp (2), yp (2), 10, 10, red)
            end if


            if xp (1) = -10 then
                xp (1) := CXB - 100
            end if
            if xp (2) = -10 then
                xp (2) := CXB - 100
            end if



            if chars (chr (32)) = true then

                counter += 1

            end if

            if counter = 1 then

                drawfilloval (xe, ye, 10 + 3, 10 + 3, white)

                xe := xe + speed

                drawfilloval (xe, ye, 10 + 3, 10 + 3, yellow)
                drawfilloval (xe, ye, 10, 10, red)

                if xe = 650 then
                    xe := CXRSBarm
                    counter -= 1

                end if



                put life, counter

                View.Update

                %Colission with Border

                if CXRSBarm >= maxx and CXSBarm = maxy and CYSBarm = maxx and CXBLSSBbody = maxy and CYTRSSBbody = maxx and CXBLSSBhead = maxy and CYTRSSBhead = maxx and CXBLSSBleftleg = maxy and CYTRSSBleftleg = maxx and CXBLSSBrightleg = maxy and CYTRSSBrightleg = maxx and CXBLSSBleftshoe = maxy and CYTRSSBleftshoe = maxx and CXBLSSBrightshoe = maxy and CYTRSSBrightshoe = CXBLSBH and CXSBarm = CYBLSBH and CYSBarm = CXBLSBH and CXBLSSBbody = CYBLSBH and CYTRSSBbody = CXBLSBH and CXBLSSBhead = CYBLSBH and CYTRSSBhead = CXBLSBH and CXBLSSBleftleg = CYBLSBH and CYTRSSBleftleg = CXBLSBH and CXBLSSBrightleg = CYBLSBH and CYTRSSBrightleg = CXBLSBH and CXBLSSBleftshoe = CYBLSBH and CYTRSSBleftshoe = CXBLSBH and CXBLSSBrightshoe = CYBLSBH and CYTRSSBrightshoe = CXBLSBH and x1 = CYBLSBH and y1 = CXBLSBH and x1 = CYBLSBH and y1 = CXBLSBH and x1 = CYBLSBH and y1 