blob: 1e9199700182a695d6f731221333cbaefda94181 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
from sprites import Point, Sprite, Vector
sempty = Sprite(None)
assert sempty.get_position() == Point(x=0, y=0)
s = Sprite(Point(x=0, y=1))
assert s.get_position() == Point(x=0, y=1)
s.move_to(Point(x=1, y=2))
assert s.get_position() == Point(x=1, y=2)
s.move_by(Vector(dx=-4, dy=2))
assert s.get_position() == Point(x=-3, y=4)
srel = Sprite.new_relative_to(Point(x=0, y=1), Vector(dx=1, dy=1.5))
assert srel.get_position() == Point(x=1, y=2.5)
|