stage.set_background("halfcourt")
sprite = codesters.Sprite("player1")
sprite.go_to(-175, -150)
net = codesters.Sprite("basketballnet")
net.go_to(215, 175)
t = codesters.Teacher()
set_gravitys = t.find_function("set_gravity_off")
try:
tval1 = stage.get_gravity()
except:
tval1 = "DNE"
try:
tval2 = set_gravitys[0][1]
except:
tval2 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == 10, "Great Job!")
t1.add_failure(tval1 == 0, "Did you set the gravity for the stage?")
t2 = TestObjective()
t2.add_success("sprite." in tval2, "Great job!")
t2.add_failure(tval2 == "DNE", "Did you drag in Sprite Gravity Off into your program?")
t2.add_failure("sprite." not in tval2, "Oops! Make sure you're turning off the gravity for your sprite, not anything else.")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)