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

Username:   Password: 
 RegisterRegister   
 Bouncing Ball
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Maverick




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
PaddyLong




PostPosted: Tue Dec 09, 2003 4:13 pm   Post subject: (No 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
Maverick




PostPosted: Tue Dec 09, 2003 5:29 pm   Post subject: (No subject)

I agree.
Metallica Rocks big time. So does Maverick
PaddyLong




PostPosted: Tue Dec 09, 2003 5:47 pm   Post subject: (No 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.....
Homer_simpson




PostPosted: Tue Dec 09, 2003 6:35 pm   Post subject: (No 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...=)
PaddyLong




PostPosted: Wed Dec 10, 2003 12:16 pm   Post subject: (No 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
Maverick




PostPosted: Wed Dec 10, 2003 1:35 pm   Post subject: (No 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
Homer_simpson




PostPosted: Wed Dec 10, 2003 6:20 pm   Post subject: (No 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
Sponsor
Sponsor
Sponsor
sponsor
gigaman




PostPosted: Thu Dec 11, 2003 6:00 pm   Post subject: (No subject)

go metallica
Thuged_Out_G




PostPosted: Sun Dec 14, 2003 1:39 am   Post subject: (No 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
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  [ 10 Posts ]
Jump to:   


Style:  
Search: