stage.set_axis(100)
stage.create_grid_overlay(10, "grey")
stage.set_background("soccerfield")
ballx = -80
bally = random.randint(-100,100)
# sprite = codesters.Sprite("image", x, y)
ball = codesters.Sprite("soccerball", ballx, bally)
netx = 90
nety = random.randint(-100,100)
# sprite = codesters.Sprite("image", x, y)
net = codesters.Sprite("soccernet", netx, nety)
net.flip_right_left()
#sprite = codesters.Line(x-start, y-start, x-end, y-end, "color")
line = codesters.Line(ballx, bally, netx, nety, "blue")
slopeguess = float(line.ask("What is the slope of this line?"))
rise = nety - bally
run = netx - ballx
slope = rise / run
# sprite = codesters.Text("text", x, y)
sprite = codesters.Text(slope, 0, 30)
newrise = slopeguess*run
t = codesters.Teacher()
ends = t.find_text("end_y")
try:
tval1 = ends[0][1].replace(" ", "")
except:
tval1 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == "end_y=newrise+bally" , "Great Job!")
t1.add_success(tval1 == "end_y=bally+newrise", "Great Job!")
t1.add_failure(tval1 == "DNE", "Did you drag out Addition and change my_var to end_y?")
t1.add_failure("+" not in tval1, "Did you drag out an Addition command?")
t1.add_failure("newrise" not in tval1, "Did you change the 2 to newrise?")
t1.add_failure("bally" not in tval1, "Did you change the 3 to bally?")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()