
-----------------------------------
we64
Sun Feb 22, 2004 12:05 pm

I am having trouble with this car movement and collision
-----------------------------------
When I run this in Windows XP and it is kind of slow. I checked the task manager and it shows that cpu has been using 100%. I don't know why, is the code not efficient or something?


var chars : array char of boolean
var x, y : int := 0
var winID : int
winID := Window.Open ("position:centre;top,graphics:600;670")

View.Set ("offscreenonly")

loop
    View.Update
    drawline (90, 0, 90, maxy, black)

    drawfillbox (100 + x, 110, 125 + x, 175, white)   %Body
    drawfillbox (95 + x, 120, 100 + x, 130, white)   %Left Rare Tire
    drawfillbox (95 + x, 155, 100 + x, 165, white)  %Left Front Tire
    drawfillbox (125 + x, 120, 130 + x, 130, white)   %Right Rare Tire
    drawfillbox (125 + x, 155, 130 + x, 165, white)   %Right Front Tire

    drawfillbox (300, 400 + y, 350, 350 + y, white) %Block
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        y -= 1
    elsif chars (KEY_DOWN_ARROW) then
        y += 1
    elsif chars (KEY_LEFT_ARROW) then
        x -= 1
    elsif chars (KEY_RIGHT_ARROW) then
        x += 1
    end if

    if x 