# Program variables (DON'T DELETE!!!)
block_speed = -6 # controls how fast the pipes move across the stage
block_gap = 200 # controls the space between the top and bottom of each pipe
block_interval = 1 # controls how often a new pipe appears
gravity = 10 # controls how fast the sprite falls
flappiness = 5 # controls how much the sprite moves up
# Store and display score
score = 0
score_text = codesters.Text("Score: " + str(score), 100, 200, "yellow")
########################################################################
# ADD CODE BELOW THIS LINE #
########################################################################
stage.set_background("space")
stage.disable_all_walls()
sprite = codesters.Sprite("dinosaur")
sprite.set_size(0.4)
sprite.set_say_color("yellow")
t = codesters.Teacher()
says = t.find_function("say")
go_tos = t.find_function("go_to")
try:
tval1 = says[0][1].lower().replace(' ','')
except:
tval1 = "DNE"
try:
tval2 = go_tos[0][1].lower().replace(' ','')
except:
tval2 = "DNE"
t1 = TestObjective()
t1.add_success('"TAPTHESPACEBARTOGUIDEMETHROUGHTHEBLOCKS!",3)'.lower() in tval1, "Great Job!")
t1.add_failure(tval1 == "DNE", "Did you add Say for Time in the program?")
t1.add_failure(tval1 != "DNE" and ',3)' not in tval1, "Did you change the time that the say lasts from 2 to 3?")
t1.add_creative(',3)' in tval1 and '"TAPTHESPACEBARTOGUIDEMETHROUGHTHEBLOCKS!"'.lower() not in tval1, "Nice! That's a good message too.")
t2 = TestObjective()
t2.add_success('(-200,0)' in tval2, "Great job!")
t2.add_failure(tval2 == "DNE", "Did you add Go To to the program?")
t2.add_failure(tval2 != "DNE" and '(-200,0)' not in tval2, "Did you change the coordinates of the Go To to be (-200, 0)?")
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)