Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
tripy ball program
Author Message
WhatAmIDoing

Posted: Fri Feb 27, 2004 2:36 pm   Post subject: tripy ball program

hey this is my first program (screen saver) so tell me what you think of it

setscreen ("graphics")
%starting coordinates
var y, y2, x2, x, x3, y3, y4, x4, c : int := 10
y := 40
x := 40
x2 := maxx - 40
y2 := maxy - 40
y3 := maxy - 40
x3 := 40
y4 := 40
x4 := maxx - 40
%gets speed and clears the screen
var ySpeed, xSpeed : int := 10
var y2Speed, x2Speed : int := 10
var y3Speed, x3Speed : int := 10
var y4Speed, x4Speed : int := 10
%moves ball and bounces off side
loop
%ball_1
randint (c, 1, 50)

if y >= maxy - 30 or y <= 30 then
ySpeed := -ySpeed
end if
if x >= maxx - 30 or x <= 30 then
xSpeed := -xSpeed
end if
y := y + ySpeed
x := x + xSpeed
drawfilloval (x, y, 30, 30, c)
delay (10)
drawfilloval (x, y, 30, 30, c)
%ball_2
if y2 >= maxy - 30 or y2 <= 30 then
y2Speed := -y2Speed
end if
if x2 >= maxx - 30 or x2 <= 30 then
x2Speed := -x2Speed
end if
y2 := y2 + y2Speed
x2 := x2 + x2Speed
drawfilloval (x2, y2, 30, 30, c)
delay (10)
drawfilloval (x2, y2, 30, 30, c)
%ball_3
if y3 >= maxy - 30 or y3 <= 30 then
y3Speed := -y3Speed
end if
if x3 >= maxx - 30 or x3 <= 30 then
x3Speed := -x3Speed
end if
y3 := y3 + y3Speed
x3 := x3 + x3Speed
drawfilloval (x3, y3, 30, 30, c)
delay (10)
drawfilloval (x3, y3, 30, 30, c)
%ball_4
if y4 >= maxy - 30 or y4 <= 30 then
y4Speed := -y4Speed
end if
if x4 >= maxx - 30 or x4 <= 30 then
x4Speed := -x4Speed
end if
y4 := y4 + y4Speed
x4 := x4 + x4Speed
drawfilloval (x4, y4, 30, 30, c)
delay (10)
drawfilloval (x4, y4, 30, 30, c)
end loop

shorthair

Posted: Fri Feb 27, 2004 3:28 pm   Post subject: (No subject)

This does not belong in here , but anyways its a nice little thing , i guess if your new i should be impressed , but its not that great
Paul

Posted: Fri Feb 27, 2004 5:12 pm   Post subject: (No subject)

Yea, trippy alright, but if you make it move in different patterns after a while, it would be better.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 3 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: