Computer Science Canada bouncing balls |
Author: | gtahunter [ Sun May 13, 2007 7:37 pm ] |
Post subject: | bouncing balls |
this program has balls continuously bouncing off the sides of the window var xdir:int var ydir:int var xpos:int var ypos:int var xdir1:int var ydir1:int var xpos1:int var ypos1:int xdir :=1 ydir :=2 xpos :=50 ypos :=100 xdir1:=2 ydir1:=2 xpos1:=100 ypos1:=45 setscreen("graphics:400;400") loop cls if xpos >= maxx or xpos <= 0 then xdir*=-1 end if if xpos1 >= maxx or xpos1 <= 0 then xdir1*=-1 end if if ypos >= maxy or ypos <= 0 then ydir*=-1 end if if ypos1 >= maxy or ypos1 <= 0 then ydir1*=-1 end if xpos+=xdir ypos+=ydir xpos1+=xdir1 ypos1+=ydir1 drawfilloval(xpos,ypos,10,10,255) delay(5) drawfilloval(xpos1,ypos1,10,10,255) delay(5) if xpos=xpos1 then end if end loop |
Author: | Prince Pwn [ Sun May 13, 2007 9:17 pm ] | ||
Post subject: | Re: bouncing balls | ||
It looks better like this:
|
Author: | lilmizeminem [ Wed May 16, 2007 11:15 am ] |
Post subject: | RE:bouncing balls |
cooooooool. |
Author: | petree08 [ Wed May 23, 2007 11:06 am ] |
Post subject: | RE:bouncing balls |
er yeah try using an array |
Author: | Tallguy [ Thu May 24, 2007 12:11 pm ] |
Post subject: | RE:bouncing balls |
very cool, but is there a point to this? |
Author: | carGUY17 [ Mon May 28, 2007 6:46 pm ] |
Post subject: | Re: bouncing balls |
sorry but that really sucks. |
Author: | TWizard [ Sun Aug 13, 2017 12:15 pm ] | ||
Post subject: | Re: bouncing balls | ||
Thought I would give this abit of an update. There was some flickering, which is now removed. I've removed the delays, and added a counter system.
|