def draw(self, canvas): pygame.draw.circle(canvas, (0, 0, 255), self.pos, 15) # traza draw_vector(canvas, GREEN, Vector2(0, 0), self.pos) draw_vector(canvas, RED, self.pos, self.pos + self.vel * self.speed * 10)
def test_theta_zero_degrees(): v = Vector2(1, 0) assert v.theta == 0
def __init__(self, size): self.box = Rect((0, 0), size) self.pos = Vector2(*self.box.center) self.vel = Vector2.random_unit() self.speed = random.randrange(3, 10)