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

Username:   Password: 
 RegisterRegister   
 It bounces and bounces and bounces and doh!!! it stopped =Þ
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: Fri Apr 25, 2003 7:42 pm   Post subject: It bounces and bounces and bounces and doh!!! it stopped =Þ

code:
procedure jspeed (var s : real, i, ii : int)
    var x, y : real
    %s := sqrt ((i ** 2) - (ii ** 2))
    s := ((- ((ii / i) ** 2)) + 100)
end jspeed

var y := 0.0
var bouncability := 10
colorback (16)
View.Set ("offscreenonly")
for decreasing b : 100 .. 10 by bouncability
    for i : -b .. b
        jspeed (y, 10, i)
        drawfilloval (320, round (y) + 200 - (100 - b), 10, 10, 9)
        drawline (0, 190, 640, 190, 12)
        View.Update
        delay (1)
        cls
    end for
end for

ok here's a bounce formula i've just made up doe's anyone know where i can get the physic formulas like gravity ,speed, acceleration,etc...?!!!
Sponsor
Sponsor
Sponsor
sponsor
Prince




PostPosted: Fri Apr 25, 2003 7:50 pm   Post subject: (No subject)

a physics book might help ya Razz
Homer_simpson




PostPosted: Fri Apr 25, 2003 7:54 pm   Post subject: (No subject)

i dont have a physic book and i'm not planning to buy one... =(
i thought there might be a website or something... =/
Blade




PostPosted: Fri Apr 25, 2003 8:00 pm   Post subject: (No subject)

again... catalyst.... or tony.... they're awesome at physics (i havent taken physics yet...Sad but i dont think catalyst has either, he's only in grade 10... he's just a damned genius)
Homer_simpson




PostPosted: Fri Apr 25, 2003 8:21 pm   Post subject: (No subject)

code:
procedure jspeed (var s : real, i, ii : int)
    var x, y : real
    %s := sqrt ((i ** 2) - (ii ** 2))
    s := ((- ((ii / i) ** 2)) + 100)
end jspeed

var y, x, x2 := 0.0

var bouncability := 10
colorback (16)
cls
View.Set ("offscreenonly")
for decreasing b : 100 .. 10 by bouncability
    for i : -b .. b by 5
        jspeed (y, 10, i)
        if i > 0 then
            jspeed (x, 10, i)
        else
            jspeed (x, 10, -i)
        end if
        x2 += x div 30
        drawfilloval (round (x2), round (y) + 200 - (100 - b), 10, 10, 9)
        drawdot (round (x2) - 11, round (y) + 200 - (100 - b) - 11, 15)
        drawline (0, 190, 640, 190, 12)
        View.Update
        delay (10)
        drawfilloval (round (x2), round (y) + 200 - (100 - b), 10, 10, 16)
    end for
end for

alittle more enhanced one
Homer_simpson




PostPosted: Fri Apr 25, 2003 8:31 pm   Post subject: (No subject)

better yet
code:
procedure jspeed (var s : real, i, ii : int)
    var x, y : real
    %s := sqrt ((i ** 2) - (ii ** 2))
    s := ((- ((ii / i) ** 2)) + 100)
end jspeed

var y, x, x2 := 0.0
var xx1, xx2, yy1, yy2 := 0

var bouncability := 10
colorback (16)
cls
View.Set ("offscreenonly")
for decreasing b : 100 .. 10 by bouncability
    for i : -b .. b by 5
        jspeed (y, 10, i)
        if i > 0 then
            jspeed (x, 10, i)
        else
            jspeed (x, 10, -i)
        end if
        x2 += x div 30
        drawfilloval (round (x2), round (y) + 200 - (100 - b), 10, 10, 9)
        xx1 := round (x2) - 11
        yy1 := round (y) + 200 - (100 - b) - 11
        drawdot (round (x2) - 11, round (y) + 200 - (100 - b) - 11, 15)
        drawline (xx1, yy1, xx2, yy2, 12)
        xx2 := xx1
        yy2 := yy1
        View.Update
        delay (10)
        drawfilloval (round (x2), round (y) + 200 - (100 - b), 10, 10, 16)
    end for
end for
Homer_simpson




PostPosted: Fri Apr 25, 2003 11:53 pm   Post subject: (No subject)

guess this is another way of explaining bouncing
code:
var x, y := 200
var dirx, diry := true
View.Set ("offscreenonly")
var mousex, mousey, mouseb : int

function mouseover (x, y, x1, y1, x2, y2 : int) : boolean
    if x >= x1 and x <= x2 then
        if y >= y1 and y <= y2 then
            result true
        end if
    end if
    result false
end mouseover

loop
    mousewhere (mousex, mousey, mouseb)
    drawbox (mousex - 10, mousey - 40, mousex, mousey + 40, 9)
    drawfilloval (x, y, 10, 10, 9)
    View.Update
    delay (1)
    cls
    case dirx of
        label true :
            x += 2
        label false :
            x -= 2
    end case
    case diry of
        label true :
            y -= 1
        label false :
            y += 1
    end case
    if x >= 630 or x <= 0 then
        dirx := not dirx
    end if
    if y >= 390 or y <= 0 then
        diry := not diry
    end if

    if mouseover (x, y, mousex - 10, mousey - 40, mousex, mousey + 40) then
        dirx := not dirx
    end if
    if mouseover (x, y, mousex - 10, mousey - 40, mousex, mousey + 40) then
        diry := not diry
    end if


end loop
Tony




PostPosted: Fri Apr 25, 2003 11:54 pm   Post subject: (No subject)

good... now make pong Very Happy
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Homer_simpson




PostPosted: Sat Apr 26, 2003 12:01 am   Post subject: (No subject)

pong sux and it's too easy to make i cant believe a stupid online game of pong won a prize at the contest at http://ooturing.psychz.net/ even i could have done better
Tony




PostPosted: Sat Apr 26, 2003 12:13 am   Post subject: (No subject)

well considering they have about just 5 users.. its good for them that they got something submited Shocked
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Catalyst




PostPosted: Sat Apr 26, 2003 12:13 am   Post subject: (No subject)

pong didnt win ne thing there, tho a physics sim did
jamez




PostPosted: Sat Apr 26, 2003 8:32 am   Post subject: (No subject)

Homer dont be such an ass, especially when you have no idea of what you are talking about.

Catalyst won it with his f00kin awesome 3d space shooter type game, "Solar Blue". It r0x.
Homer_simpson




PostPosted: Sat Apr 26, 2003 11:29 am   Post subject: (No subject)

Hey dont be so critical james u jackass!!! so i thought that pong won... that doesn't make an ass Mad
Homer_simpson




PostPosted: Sat Apr 26, 2003 11:31 am   Post subject: Catalyst help!!!!

Catalyst
catalyst do u know any other websites that are like this one(http://hem.passagen.se/olle2/programmering.htm) with all those formulas documented in it?!
Tony




PostPosted: Sat Apr 26, 2003 1:50 pm   Post subject: (No subject)

Catalyst - I hope you'll be uploading your game here soon. I'd love to see it. 8)
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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 2  [ 18 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: