stage.set_background("winter")
sprite = codesters.Sprite("person12")
sprite.go_to(-125, -150)
frosty = codesters.Sprite("snowman")
frosty.go_to(100, -125)
snow = codesters.Sprite("snowflake3")
snow.go_to(100, 75)
greeting = codesters.Text("Happy Holidays!")
greeting.go_to(0, 200)
greeting.set_color("yellow")
def click(sprite):
sprite.say("I hope your holidays are great!")
sprite.turn_left(360)
# add other actions...
sprite.event_click(click)
def space_bar():
sprite.jump(5)
# add other actions...
stage.event_key("space", space_bar)
t = codesters.Teacher()
try:
params = t.find_function('set_x_speed')
tval1a = params[0][1]
tval1b = t.get_indent_at_line(params[0][0])
except:
tval1a = "DNE"
tval1b = "DNE"
try:
tval3 = t.find_function('jump')
except:
tval3 = "DNE"
t1 = TestObjective()
t1.add_success("snow" in tval1a and tval1b == 4, "Great job!")
t1.add_failure(tval1a == "DNE" or tval1b == "DNE", "Did you add a Set x Speed command to the Space Bar event?")
t1.add_failure(tval1b != 4, "Make sure your Set x Speed command is indented four spaces inside the Space Bar event.")
t1.add_failure('sprite' in tval1a, "Did you change the name in front of Set x Speed to snow?")
t2 = TestObjective()
t2.add_success(tval3 == "DNE" or tval3 == [] or tval3 == None, "Great job!")
t2.add_failure(tval3 != [], "Did you delete the jump command?")
t2.add_default("Great job!", "success")
tester = TestManager()
tester.add_test_list([t1, t2])
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)