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

Username:   Password: 
 RegisterRegister   
 help me with brick game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
thuyvy




PostPosted: Mon Jun 12, 2006 7:27 am   Post subject: help me with brick game

hi everbody , plz help me with the brick game , i can not make the ball hit the paddle , & help me how to make the bricks

setscreen ("graphics:max;max,nobuttonbar")

% The "View.Update" program.
% Place some circles around the screen
const RADIUS : int := 10
var x, y, dx, dy, clr : array 1 .. 1 of int
var x1, y1, button : int
var paddleHEIGHT: int:=5
x (1) := Rand.Int (RADIUS, maxx - RADIUS)
y (1) := Rand.Int (RADIUS, maxy - RADIUS)
dx (1) := Rand.Int (-3, 3)
dy (1) := Rand.Int (-3, 3)
clr (1) := Rand.Int (1, 15)


% Now, any drawing to the screen won't appear until a
% View.Update is given.
View.Set ("offscreenonly")
loop

cls % Clear the offscreen window
mousewhere (x1, y1, button)
drawfillbox (x1,20,x1+100,paddleHEIGHT,black)

if x (1) + dx (1) < RADIUS or
x (1) + dx (1) > maxx - RADIUS then
dx (1) := -dx (1)
end if
if y (1) + dy (1) < RADIUS or
y (1) + dy (1) > maxy - RADIUS then
dy (1) := -dy (1)
end if
x (1) := x (1) + dx (1)
y (1) := y (1) + dy (1)



Draw.FillOval (x (1), y (1), RADIUS, RADIUS, clr (1))

% All the circles have been drawn. Now update the screen.
View.Update

Time.Delay (7)
exit when y (1)= 0
end loop
Sponsor
Sponsor
Sponsor
sponsor
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  [ 1 Posts ]
Jump to:   


Style:  
Search: