
-----------------------------------
chipanpriest
Sun Dec 18, 2011 4:15 pm

Pong by chipanpriest
-----------------------------------
This is my version of pong xD enjoy

 
var paddlesize, paddle1pos, paddle2pos, ballx, bally : int
var ballspeed1, ballspeed2, font, score1, score2 : int
var ch : array char of boolean
paddlesize := 25
ballx := maxx div 2
bally := maxy div 2
ballspeed1 := 2
ballspeed2 := 2
paddle1pos := maxy div 2
paddle2pos := maxy div 2
score1 := 0
score2 := 0
font := Font.New ("Impact:48:bold")

View.Set ("graphics:1000;600,offscreenonly")
colourback (7)
cls
loop
    loop
        Font.Draw (intstr (score1), 100, 500, font, 0)
        Font.Draw (intstr (score2), 800, 500, font, 0)
        exit when score1 = 10 or score2 = 10
        Input.KeyDown (ch)
        if ch (KEY_DOWN_ARROW) then
            paddle2pos := paddle2pos - 2
        elsif ch (KEY_UP_ARROW) then
            paddle2pos := paddle2pos + 2
        end if

        if ch ('s') then
            paddle1pos := paddle1pos - 2
        elsif ch ('w') then
            paddle1pos := paddle1pos + 2
        end if

        if paddle1pos  450 - paddlesize then
            paddle1pos := 450 - paddlesize
        end if

        if paddle2pos  450 - paddlesize then
            paddle2pos := 450 - paddlesize
        end if

        ballx := ballx + ballspeed1
        bally := bally + ballspeed2

        if ballx >= 980 and bally >= paddle2pos - paddlesize and bally 