All pastes #189889 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-10-03 14:40 UTC
rendered paste body
View.Set ("graphics:max,max")
var size : int := 50
var mx, my, mb : int
var ballx, bally : int := 200
var dirx, diry : int := 0
var ballspeed : int := 1

dirx := ballspeed
diry := ballspeed

loop
delay (1)    

mousewhere (mx, my, mb)
    drawfillbox (mx - size, 0, mx + size, 50, black)
    drawfillbox (mx - size - 1, 0, 0, 50, white)
    drawfillbox (maxx, 0, mx + size + 1, 50, white)
    drawfilloval (ballx, bally, 30, 30, white)
    ballx += dirx
    bally += diry
    drawfilloval (ballx, bally, 30, 30, blue)


    if ballx >= maxx then
        dirx := - (dirx)

    elsif bally >= maxy then
        diry := - (diry)

    elsif ballx <= 0 then
        dirx := - (dirx)

    elsif bally <= 0 then
        locate (1, 1)
        put "Hahahaha lost ball"
        ballx := 200
        bally := 200
        loop
            mousewhere (mx, my, mb)
            exit when mb = 1
        end loop
    end if


if ballx > mx - size and ballx < mx+size and bally < 66 then
    diry:=-(diry)
end if
end loop