stage.set_background("schoolhallway")
sprite = codesters.Sprite("person8")
stage.set_gravity(4)
stage.disable_floor()
sprite.set_gravity_off()
sprite.go_to(0, -220)
score = 0
score_board = codesters.Display(score)
my_info = ["cellphone", "address", "birthdate"]
def left_key():
sprite.move_left(20)
# add other actions...
stage.event_key("left", left_key)
def right_key():
sprite.move_right(20)
# add other actions...
stage.event_key("right", right_key)
def interval():
x = random.randint(-230, 230)
info_img = random.choice(my_info)
# sprite = codesters.Sprite("image", x, y)
info = codesters.Sprite(info_img, 0, 0)
# add any other actions...
stage.event_interval(interval, 3)
t = codesters.Teacher()
sp_params = t.get_parameters_for_function('Sprite')
try:
tval3 = sp_params[1][0]
tval4 = sp_params[1][1]
tval5 = int(sp_params[1][2])
except:
tval3 = "DNE"
tval4 = "DNE"
tval5 = "DNE"
t1 = TestObjective()
t1.add_success(tval4 == 'x' and tval5 == 275, "Great job!")
t1.add_failure(tval4 == "DNE", "Oops! Did you delete your Sprite at Position?")
t1.add_failure(tval5 == "DNE", "Oops! DId you delete your Sprite at Position?")
t1.add_failure(tval4 != 'x', "Did you change the x-coordinate to the variable x?")
t1.add_failure(tval5 != 275, "Did you change the y-coordinate to 275?")
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)