Computer Science Canada

Why this no work! (whatdotcolour help plz)

Author:  romox15x [ Wed Jan 16, 2008 12:46 pm ]
Post subject:  Why this no work! (whatdotcolour help plz)

I want to make it do something when it hits that colour but its not working why?



code:


var x, y : int
x := 631
y := 25
loop

var chars : array char of boolean

    Input.KeyDown (chars)

    if chars (KEY_UP_ARROW) then
        y := y + 1
    end if
    if chars (KEY_RIGHT_ARROW) then
        x := x + 1
    end if
    if chars (KEY_LEFT_ARROW) then
        x := x - 1
    end if
    if chars (KEY_DOWN_ARROW) then
        y := y - 1
    end if

      delay(10)
cls




% I want it to exit when it hits this colour

if whatdotcolor(x,y) = 1 then
delay(99999)










end if
View.Update
drawfilloval(x,y,1,1,7)
drawfillbox(100,100,200,200,1)
end loop

Author:  Zampano [ Wed Jan 16, 2008 1:38 pm ]
Post subject:  Re: Why this no work! (whatdotcolour help plz)

Because you're clsing every time before the whatdotcolour checks, meaning that it (the blue square) is whitened before the collision check and is made blue right after, and so forth. Also, you initialize the ball off the screen. Try reevaluating the order you do some of things in here. There's a problem when you have a View.Update then the drawing.

Edit: Furthermore, you're not even in offscreenonly mode!


: