sprite = codesters.Sprite("knight1", -175, -150)
sprite.set_speed(2)
def park_scene():
stage.set_background("park")
sprite.say("I should hurry to the castle!")
sprite.move_forward(550)
park_scene()
def bridge_scene():
stage.set_background("drawbridge")
sprite.go_to(-175, -150)
sprite.say("I made it!")
stage.wait(2)
bridge_scene()
def battle_scene():
dragon = codesters.Sprite("dragon", 150, -150)
sprite.say("Oh no a dragon!")
sprite.move_forward(300)
dragon.turn_left(360)
dragon.move_down(200)
sprite.say("The path is clear!")
t = codesters.Teacher()
try:
func_call = t.find_text('battle_scene')
line = func_call[1][0]
tval1 = t.get_indent_at_line(line)
tval2 = func_call[1][1]
except:
func_call = "DNE"
line = "DNE"
tval1 = "DNE"
tval2 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == 0 and "battle_scene()" in tval2, "Great job!")
t1.add_failure(tval1 == "DNE", "Did you drag in a Call Function command and change the name to battle_scene?")
t1.add_failure(tval1 > 0, "Make sure your Call Function command is not indented.")
t1.add_failure('battle_scene()' not in tval2, "Did you call your function by typing its name and parens?")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Enviar Trabajo
-
Actividad Siguiente
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)