Add collision detection, finish line and level up
Task: MIL-005#1 Task: MIL-005#2 Task: MIL-005#3 Task: MIL-005#4
This commit is contained in:
+16
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from constants import MOVE_DISTANCE, STARTING_POSITION
|
||||
from constants import FINISH_LINE_Y, MOVE_DISTANCE, STARTING_POSITION
|
||||
from player import Player
|
||||
|
||||
|
||||
@@ -27,6 +27,21 @@ def test_go_up_moves_forward_by_move_distance(player: Player) -> None:
|
||||
assert player.ycor() == start_y + MOVE_DISTANCE
|
||||
|
||||
|
||||
def test_player_is_not_at_finish_line_at_start(player: Player) -> None:
|
||||
assert not player.is_at_finish_line()
|
||||
|
||||
|
||||
def test_player_is_at_finish_line_above_finish_y(player: Player) -> None:
|
||||
player.goto(0, FINISH_LINE_Y + 1)
|
||||
assert player.is_at_finish_line()
|
||||
|
||||
|
||||
def test_go_to_start_returns_to_starting_position(player: Player) -> None:
|
||||
player.goto(0, FINISH_LINE_Y + 1)
|
||||
player.go_to_start()
|
||||
assert player.position() == STARTING_POSITION
|
||||
|
||||
|
||||
def test_go_up_never_moves_sideways(player: Player) -> None:
|
||||
for _ in range(5):
|
||||
player.go_up()
|
||||
|
||||
Reference in New Issue
Block a user