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

Username:   Password: 
 RegisterRegister   
 move a circle
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Crazya




PostPosted: Thu Mar 22, 2007 11:49 am   Post subject: move a circle

%Aaron Hazley

var keys : array char of boolean
var x, y,r, xSize, ySize : int
r := 10
x := r + 16
y := maxy div 2 + 185
xSize := 5
ySize := 5
colourback (black)
cls
View.Set ("offscreenonly")
loop
delay (10)
Draw.FillOval (x, y, r, r, black)
Input.KeyDown (keys)
if keys (KEY_UP_ARROW) and whatdotcolour (x, y + r + 1) ~= brightred and y < maxy - ySize then
y := y + 3
end if
if keys (KEY_LEFT_ARROW) and whatdotcolour (x - r - 1, y) ~= brightred and x > 0 then
x := x - 3
end if
if keys (KEY_RIGHT_ARROW) and whatdotcolour (x + r + 1, y) ~= brightred and x < maxx - xSize then
x := x + 3
end if
if keys (KEY_DOWN_ARROW) and whatdotcolour (x, y - r - 1) ~= brightred and y > ySize then
y := y - 3
end if
Draw.FillOval (x, y, r, r, brightgreen)
View.Update
end loop
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: