Computer Science Canada

Erasing paddle using View.Update

Author:  mike200015 [ Sun Mar 20, 2005 12:54 am ]
Post subject:  Erasing paddle using View.Update

in my pong game, im making a new section to it.. and i made the paddle.. and the keys to move.. and im using View.Update so when the paddle moves it will show it in the new position.. but it doesnt seem to be working.

code:
var chars : array char of boolean
var ballx := maxx div 2
var bally := 15
var pos := maxx div 2
setscreen ("offscreenonly")
loop
    drawfillbox (pos - 25, 0, pos + 25, 5, blue) %user paddle
    drawfilloval (ballx, bally, 10, 10, 12)                 %ball
    Input.KeyDown (chars)
    if chars (KEY_LEFT_ARROW) and pos - 25 > 0 then  %Moves paddle left
        pos -= 1
        ballx -= 1
    elsif chars (KEY_RIGHT_ARROW) and pos + 30 < maxx then              %Moves paddle right
        pos += 1
        ballx += 1
    end if
    View.Update
end loop

Does any1 know why this doesnt work.. and how to fix it?

Author:  Bacchus [ Sun Mar 20, 2005 1:00 am ]
Post subject: 

your not clearing the screen, add a cls either right after the View.Update, or right at the beginning of the loop

Author:  mike200015 [ Sun Mar 20, 2005 1:06 am ]
Post subject: 

Idea oohh right right.. forgot about that.. thnx Bacchus!


: