setscreen ("offscreenonly,graphics:700;500")
 
mousehide
 
var keyboard : array char of boolean
 
var playerx, playery : int := 200
 
var player2x, player2y : int := 222
 
var player3x, player3y : int := 375
 
var player4x, player4y : int := 400
 
var ballx, bally : int := 288
 
var x : int := 100
 
var mousex, mousey, mb : int
 
 
Input.KeyDown (keyboard)
 
 
%intro
 
cls
 
setscreen ("offscreenonly,nobuttonbar,position:truemiddle,centre,graphics:700;500")
 
colorback (black) 
 
cls
 
 
var song : int
 
var N, y, b : int := 10
 
var keyb : array char of boolean
 
var clr : int := 218 % The color to assign to
 
var text1 : int := Font.New ("Times New Roman:38:Bold") % First Font
 
 
for i : 0 .. 39
 
    RGB.SetColor (clr, 0, 0, i / 39)
 
    Font.Draw ("THUNDER PUCK 2K5", (maxx div 2) - (Font.Width ("THUNDER PUCK 2K5", text1) div 2), (maxy div 2) - 9, text1, clr)
 
    View.Update
 
    drawfillbox ((maxx div 2) - Font.Width ("THUNDER PUCK 2K5", text1) - 5, (maxy div 2) - 13, ((maxx div 2) + Font.Width ("THUNDER PUCK 2K5", text1) + 5), (maxy div 2) + 13, 7)
 
    delay (50)
 
end for
 
delay (1000)
 
for decreasing i : 39 .. 0
 
    RGB.SetColor (clr, 0, 0, i / 39)
 
    Font.Draw ("THUNDER PUCK 2K5", (maxx div 2) - (Font.Width ("THUNDER PUCK 2K5", text1) div 2), (maxy div 2) - 9, text1, clr)
 
    View.Update
 
    drawfillbox ((maxx div 2) - Font.Width ("THUNDER PUCK 2K5", text1) - 5, (maxy div 2) - 13, ((maxx div 2) + Font.Width ("THUNDER PUCK 2K5", text1) + 5), (maxy div 2) + 13, 7)
 
    delay (50)
 
end for
 
%intro
 
 
colourback (brightred)
 
 
loop
 
    View.Update
 
    cls
 
    Input.KeyDown (keyboard)
 
 
    %===================1st player=============
 
    if keyboard (KEY_UP_ARROW) then
 
        playery += 2
 
        if sqrt ((playerx - player3x) ** 2 + (playery - player3y) ** 2) < 29 or sqrt ((playerx - player4x) ** 2 + (playery - player4y) ** 2) < 29 then
 
            playery -= 2
 
        end if
 
    elsif keyboard (KEY_DOWN_ARROW) then
 
        playery -= 2
 
        if sqrt ((playerx - player3x) ** 2 + (playery - player3y) ** 2) < 29 or sqrt ((playerx - player4x) ** 2 + (playery - player4y) ** 2) < 29 then
 
            playery += 2
 
        end if
 
    end if
 
 
    if keyboard (KEY_RIGHT_ARROW) then
 
        playerx += 2
 
        if sqrt ((playerx - player3x) ** 2 + (playery - player3y) ** 2) < 29 or sqrt ((playerx - player4x) ** 2 + (playery - player4y) ** 2) < 29 then
 
            playerx -= 2
 
        end if
 
 
    elsif keyboard (KEY_LEFT_ARROW) then
 
        playerx -= 2
 
        if sqrt ((playerx - player3x) ** 2 + (playery - player3y) ** 2) < 29 or sqrt ((playerx - player4x) ** 2 + (playery - player4y) ** 2) < 29 then
 
            playerx += 2
 
        end if
 
    end if
 
 
    %===================player 2=============
 
    if keyboard ('5') then
 
        player2y += 2
 
        if sqrt ((player2x - player3x) ** 2 + (player2y - player3y) ** 2) < 29 or sqrt ((player2x - player4x) ** 2 + (player2y - player4y) ** 2) < 29 then
 
            player2y -= 2
 
        end if
 
    elsif keyboard ('2') then
 
        player2y -= 2
 
        if sqrt ((player2x - player3x) ** 2 + (player2y - player3y) ** 2) < 29 or sqrt ((player2x - player4x) ** 2 + (player2y - player4y) ** 2) < 29 then
 
            player2y += 2
 
        end if
 
    end if
 
 
    if keyboard ('3') then
 
        player2x += 2
 
        if sqrt ((player2x - player3x) ** 2 + (player2y - player3y) ** 2) < 29 or sqrt ((player2x - player4x) ** 2 + (player2y - player4y) ** 2) < 29 then
 
            player2x -= 2
 
        end if
 
 
    elsif keyboard ('1') then
 
        player2x -= 2
 
        if sqrt ((player2x - player3x) ** 2 + (player2y - player3y) ** 2) < 29 or sqrt ((player2x - player4x) ** 2 + (player2y - player4y) ** 2) < 29 then
 
            player2x += 2
 
        end if
 
    end if
 
 
    %===================player 3=============
 
    if keyboard ('i') then
 
        player3y += 2
 
        if sqrt ((player3x - playerx) ** 2 + (player3y - playery) ** 2) < 29 or sqrt ((player3x - player2x) ** 2 + (player3y - player2y) ** 2) < 29 then
 
            player3y -= 2
 
        end if
 
    elsif keyboard ('k') then
 
        player3y -= 2
 
        if sqrt ((player3x - playerx) ** 2 + (player3y - playery) ** 2) < 29 or sqrt ((player3x - player2x) ** 2 + (player3y - player2y) ** 2) < 29 then
 
            player3y += 2
 
        end if
 
    end if
 
 
    if keyboard ('l') then
 
        player3x += 2
 
        if sqrt ((player3x - playerx) ** 2 + (player3y - playery) ** 2) < 29 or sqrt ((player3x - player2x) ** 2 + (player3y - player2y) ** 2) < 29 then
 
            player3x -= 2
 
        end if
 
 
    elsif keyboard ('j') then
 
        player3x -= 2
 
        if sqrt ((player3x - playerx) ** 2 + (player3y - playery) ** 2) < 29 or sqrt ((player3x - player2x) ** 2 + (player3y - player2y) ** 2) < 29 then
 
            player3x += 2
 
        end if
 
    end if
 
 
    %===================player 4 =============
 
    if keyboard ('w') then
 
        player4y += 2
 
        if sqrt ((player4x - playerx) ** 2 + (player4y - playery) ** 2) < 29 or sqrt ((player4x - player2x) ** 2 + (player4y - player2y) ** 2) < 29 then
 
            player4y -= 2
 
        end if
 
    elsif keyboard ('s') then
 
        player4y -= 2
 
        if sqrt ((player4x - playerx) ** 2 + (player4y - playery) ** 2) < 29 or sqrt ((player4x - player2x) ** 2 + (player4y - player2y) ** 2) < 29 then
 
            player4y += 2
 
        end if
 
    end if
 
 
    if keyboard ('d') then
 
        player4x += 2
 
        if sqrt ((player4x - playerx) ** 2 + (player4y - playery) ** 2) < 29 or sqrt ((player4x - player2x) ** 2 + (player4y - player2y) ** 2) < 29 then
 
            player4x -= 2
 
        end if
 
 
    elsif keyboard ('a') then
 
        player4x -= 2
 
        if sqrt ((player4x - playerx) ** 2 + (player4y - playery) ** 2) < 29 or sqrt ((player4x - player2x) ** 2 + (player4y - player2y) ** 2) < 29 then
 
            player4x += 2
 
        end if
 
    end if
 
 
    %===================Background=============
 
    drawfillbox (0, 0, 700, 485, black)
 
    %===================player 1=============
 
    drawoval (playerx, playery, 15, 15, gray)
 
    drawfilloval (playerx, playery, 10, 10, brightblue)
 
    %===================player 2=============
 
    drawoval (player2x, player2y, 15, 15, gray)
 
    drawfilloval (player2x, player2y, 10, 10, brightblue)
 
    %===================player 3=============
 
    drawoval (player3x, player3y, 15, 15, gray)
 
    drawfilloval (player3x, player3y, 10, 10, brightred)
 
    %===================player 4=============
 
    drawoval (player4x, player4y, 15, 15, gray)
 
    drawfilloval (player4x, player4y, 10, 10, brightred)
 
    %===================Ball=============
 
    drawfilloval (ballx, bally, 7, 7, gray)
 
    %===================Arena=============
 
    %Center
 
    drawfilloval (353, 257, 50, 50, gray)
 
    drawfilloval (353, 257, 40, 40, brightred)
 
    %Goal Line Left
 
    drawfillbox (39, 230, 37, 286, 0)
 
    %Goal Line Right
 
    drawfillbox (661, 230, 659, 287, 0)
 
    %Left
 
    drawfillbox (29, 344, 39, 298, gray)
 
    drawfillbox (1, 287, 39, 298, gray)
 
    drawfillbox (1, 286, 10, 231, gray)
 
    drawfillbox (1, 230, 39, 220, gray)
 
    drawfillbox (30, 219, 39, 171, gray)
 
    %Top
 
    drawfillbox (29, 344, 237, 355, gray)
 
    drawfillbox (248, 344, 238, 483, gray)
 
    drawfillbox (249, 475, 461, 483, gray)
 
    drawfillbox (451, 475, 461, 344, gray)
 
    drawfillbox (462, 344, 669, 354, gray)
 
    %Bottom
 
    drawfillbox (30, 162, 250, 171, gray)
 
    drawfillbox (250, 162, 241, 14, gray)
 
    drawfillbox (241, 6, 452, 14, gray)
 
    drawfillbox (461, 6, 452, 172, gray)
 
    drawfillbox (461, 163, 660, 172, gray)
 
    %Right
 
    drawfillbox (659, 343, 669, 297, gray)
 
    drawfillbox (659, 288, 699, 298, gray)
 
    drawfillbox (690, 288, 699, 221, gray)
 
    drawfillbox (659, 221, 689, 231, gray)
 
    drawfillbox (659, 220, 669, 163, gray)
 
    %===================ScoreBoard=============
 
    put " BlueScore:                                                              Red Score:  "
 
    %===================MouseCord...=============
 
    locate (1, 1)
 
    Mouse.Where (mousex, mousey, mb)
 
    colour (0)
 
    %put mousex, ", ", mousey
 
 
    if playerx > 39 and playerx < 251 and (playery > 17 and playery < 175 or playery > 344 and playery < 473) then
 
        put "here"
 
    end if
 
end loop
 
  |