stage.set_background("space")
sprite = codesters.Sprite("spaceship")
sprite.set_size(0.5)
sprite.go_to(-200, 0)
stage.set_gravity(10)
stage.disable_all_walls()
def space_bar():
sprite.jump(5)
# add other actions...
stage.event_key("space", space_bar)
def interval():
top_height = random.randint(1,10)
# add any other actions...
stage.event_interval(interval, 2)
t = codesters.Teacher()
try:
params = t.find_function("Sprite")
tval1 = t.get_indent_at_line(params[1][0])
tval2 = params[1][1]
except:
tval1 = "DNE"
tval2 = "DNE"
#print(tval1)
tester = TestManager()
t1 = TestObjective()
t1.add_success(tval1 == 4 and "Sprite" in tval2 and "asteroid" in tval2, "Great job!")
t1.add_failure('"asteroid"' not in tval2, 'Did you change the image label to "asteroid"?')
t1.add_failure(tval1 == "DNE", "Did you add a Sprite at Position to your interval event?")
t1.add_failure(tval1 == 0, "Make sure your code is indented four spaces inside the interval event")
# print params
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()