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)
t = codesters.Teacher()
newrises = t.find_text("newrise")
try:
tval1 = newrises[0][1].replace(" ", "")
except:
tval1 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == "newrise=slopeguess*run" , "Great Job!")
t1.add_failure(tval1 == "DNE", "Did you drag out Multiplication and change my_var to newrise?")
t1.add_failure("*" not in tval1, "Did you drag out a Multiplication command?")
t1.add_failure("slopeguess" not in tval1, "Did you change the 2 to slopeguess?")
t1.add_failure("run" not in tval1, "Did you change the 3 to run?")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()