Computer Science Canada

Bouncing Ball

Author:  Maverick [ Tue Dec 09, 2003 3:53 pm ]
Post subject:  Bouncing Ball

Here is my bouncing ball program. I know it kinda sucks, but its my first year programming in grade 10 and i suck at it.

code:

%n00bish bouncing ball
setscreen("nocursor")
setscreen("graphics:400;350")
var ballx,bally,ballxdir,ballydir:int
drawfillbox(1,1,400,350,blue)
randint(ballx,0,maxx)
randint(bally,0,maxy)

ballxdir:=1
ballydir:=1

loop
    drawfilloval(ballx,bally,5,5,12)
    delay(1)
    drawfilloval(ballx,bally,5,5,0)
   
if ballx>maxx and ballxdir>0 then
ballxdir:=-ballxdir
elsif ballx<0 and ballxdir<0 then
ballxdir:=-ballxdir
elsif bally>maxy and ballydir>0 then
ballydir:=-ballydir
elsif bally<0 and ballydir<0 then
ballydir:=-ballydir
end if
ballx +=ballxdir
bally+=ballydir
end loop

Author:  PaddyLong [ Tue Dec 09, 2003 4:13 pm ]
Post subject: 

aieeee!!!


+BITS for the sig pic man Very Happy we need more metal heads round these parts and I watched Maverick the other day... great movie

Bat Burn :grab: Rainbow Head Bang Head Bang Head Bang

Author:  Maverick [ Tue Dec 09, 2003 5:29 pm ]
Post subject: 

I agree.
Metallica Rocks big time. So does Maverick

Author:  PaddyLong [ Tue Dec 09, 2003 5:47 pm ]
Post subject: 

new Metallica is pretty bad, after Cliff died, they started going down hill, I have no problem with Jason at all, just I think the rest of the band was affected by Cliff's death so they changed

some bands you should listen to if you don't already.... Pantera, Slayer, Black Sabbath, Ozzy's solo stuff, Children of Bodom, Black Label Society, Testament.....

Author:  Homer_simpson [ Tue Dec 09, 2003 6:35 pm ]
Post subject: 

well.... their new album is kinda like a new metallica style... at first i didn't like it... but when i listened to it for a while ... it's not that bad...
btw that master of puppets picture used to be my desktop background for a while...=)

Author:  PaddyLong [ Wed Dec 10, 2003 12:16 pm ]
Post subject: 

ride the lightning is my favourite metallica album ... but if you like thrash, then you should check out Testament .. a few good songs off the top of my head are D.N.R. (Do Not Resuscitate), True Believer, Allegiance, Electric Crown, So Many Lies, Agony

Author:  Maverick [ Wed Dec 10, 2003 1:35 pm ]
Post subject: 

Well i'm not really into Slayer and Pantera, but i listen to Ozzy, Black Sabbath, and Bodom.

Other really good bands are Motorhead and Ironmaiden.

Dance

Author:  Homer_simpson [ Wed Dec 10, 2003 6:20 pm ]
Post subject: 

pantera's good... so's slayer....
here are a couple of bands u should know about if yer a rocker:
In flames
Arch Enemy
Iced Earth
soulfly
at the gates

Author:  gigaman [ Thu Dec 11, 2003 6:00 pm ]
Post subject: 

go metallica

Author:  Thuged_Out_G [ Sun Dec 14, 2003 1:39 am ]
Post subject: 

Head Bang UP THE IRONS!!!Head Bang

heh, iron maiden rules

code:

setscreen ("offscreenonly")
setscreen ("graphics:300;250")
var ballx, bally : real
var ballxdir, ballydir:real
ballx:=Rand.Int ( 0, maxx)
bally:=Rand.Int ( 0, maxy)
ballydir := 0.1
ballxdir := 0.1

loop
    cls
    colorback (black)
    drawfilloval (round(ballx), round(bally), 5, 5, 10)
    delay (1)
    if ballx > maxx and ballxdir > 0 then
        ballxdir := -ballxdir
    elsif ballx < 0 and ballxdir < 0 then
        ballxdir := -ballxdir
    elsif bally > maxy and ballydir > 0 then
        ballydir := -ballydir
    elsif bally < 0 and ballydir < 0 then
        ballydir := -ballydir
    end if
    ballx += ballxdir
    bally += ballydir
    View.Update
end loop


that code wont leave a trail behind the ball, unless you were going for that...and you can also slow the ball down alot more, by making the variables real instead of int..allowing you to make it as low as .1


: