Can anyone help me modify the code so the ball starts in random directions
Steven D'Aprano
steve at pearwood.info
Fri Dec 11 19:55:47 EST 2015
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
More information about the Python-list
mailing list