Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Why this no work! (whatdotcolour help plz)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
romox15x




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Zampano




PostPosted: 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!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: