Can anyone help me modify the code so the ball starts in random directions
phamtony33 at gmail.com
phamtony33 at gmail.com
Fri Dec 11 20:04:30 EST 2015
On Friday, December 11, 2015 at 7:55:59 PM UTC-5, Steven D'Aprano wrote:
> On Sat, 12 Dec 2015 10:19 am, phamtony33 at gmail.com wrote:
>
> > Can anyone direct me in the direction where to start the code for the
> > randomized of the ball to start.
>
> [...]
> > move_ball(-10, 7, 0)
>
>
> That starts the ball moving, with x-speed of -10 and y-speed of 7. Instead
> use something similar to this:
>
>
> import random
> xspeed = random.randint(-20, 20)
> yspeed = random.randint(-10, 10)
>
> move_ball(xspeed, yspeed, 0)
>
>
>
>
> --
> Steven
Oh yes! Thank you so much!
More information about the Python-list
mailing list