Computer Science Canada

Is it normal - Using Classes

Author:  Pickles [ Sat May 22, 2004 7:48 pm ]
Post subject:  Is it normal - Using Classes

Alright im converting my straight line program into Classes. (Its gorillas) and on the first throw it goes slow, but on any throw after that it speeds up, is it normal that when using classes taht the first run through is slow. I cant seem to find any reason why it would be doing this so i was just wondering if this is something that happens normally when using classes, or should i be looking harder

Author:  Bob565656 [ Sat May 22, 2004 8:03 pm ]
Post subject:  hey

the way i see it, using classes is like including files with procedures in it. if im wrong please correct me =) therefore, using classes shouldnt slow down ur program at all. its just importing predefined procedures 2 use.

Im gonna suggest 2 look harder. Ive come 2 realize that turing is gay lol. the dumbest mistakes are so hard 2 find :O anywho, gl

Author:  Mazer [ Sat May 22, 2004 8:11 pm ]
Post subject: 

Off the top of my head (having not seen any code) could it be that you set the speed too low at first, and then for some reason you increase it after the first time?

Author:  Pickles [ Sat May 22, 2004 8:42 pm ]
Post subject:  ..

I dont think so..

code:
    proc Throw (pictureback, x, y, angle, typer, player, originalVelocity, weight : int, grav : real)
        t := 0.0
        counter := 1
        loop
            Pic.Draw (pictureback, 0, 75, picCopy)
            counter += 1
            t += .05
            delay (40)
            x22 := (x + (round (originalVelocity * t * cosd (angle) - (.5 * (5 / 500) * cosd (angle) * t) ** 2)))
            y22 := ((y + 40) + (round (originalVelocity * t * sind (angle) - (.5 * (9.8 + (5 / 500) * sind (angle)) * t ** 2))))
            if counter = 1 then
                Pic.Draw (banana1, x22, y22, picMerge)
                View.Update
            elsif counter = 2 then
                Pic.Draw (banana2, x22, y22, picMerge)
                View.Update
            elsif counter = 3 then
                Pic.Draw (banana3, x22, y22, picMerge)
                View.Update
            elsif counter = 4 then
                Pic.Draw (banana4, x22, y22, picMerge)
                View.Update
                counter := 1
            end if
            exit when x22 > maxx
            DetectHitBuilding (x22, y22, 1)
            exit when buildinghit = true
        end loop
        Draw.FillOval (x22 + 6, y22 + 6, 10, 10, brightred)
        t := 0
        View.Update
    end Throw


thats the code in my class which draws the banana going through the air. and then in my run program all it is is:

code:
Banana.Throw (pictureback, beanyx, beanyy, 10, 1, 1, 210, 500, 9.8)


everything seems to be constant through every run through..

Author:  Pickles [ Sun May 23, 2004 12:24 am ]
Post subject:  ..

nm my computers just playing tricks on me i guess, i went down and watched a movie and came up and it was working fine.. dunno what was wrong. I guess those turing progamming elves fixed er up for me


: