Racey – Add-ons

8. Racey – Direction Vectors

Now we want to add a vector for movement. STEP ONE: MODIFYING THE INIT FUNCTION Inside our class initialisation function ( __init__) we can create a vector for movement add the following to the __init__ function # Create a random speed vector.movespeed = random.randint(1, 10)directionx = random.random()*movespeed * random.choice((-1, 1))directiony = random.random()*movespeed * random.choice((-1, 1))self.vector

8. Racey – Direction Vectors Read More »