Sprites whose coordinates are outside of the bounds of the stage, will be invisible. You can use a sprite.go_to(x,y) command to relocate and find your sprite. Once you know that your sprite is off stage, you need to debug your program and fix the command(s) that caused the sprite to be out of bounds on the stage.
# Go_to and Glide commands are in the ACTIONS Toolkit - MOVING SPRITES
# EXAMPLE 1 - Move the Sprite off of the stage
sprite = codesters.Sprite("person10",0,0)
sprite.say("Example 1")
stage.wait(3)
sprite.say("Here I am center stage")
stage.wait(3)
sprite.say("Now I will look like I am gone but I will be off of the stage")
stage.wait(4)
sprite.say("because of a sprite.go_to(300,300) in the program")
stage.wait(4)
sprite.say("The largest stage is 250 pixels in all driections from the center")
stage.wait(4)
sprite.say("")
# This statement moves the sprite off of the stage to the upper right corner
sprite.go_to(300,300)
stage.wait(3)
# EXAMPLE 2 - Bring sprite back
text = codesters.Text("Example 2",0,150)
stage.wait(3)
text.set_text("I am currently off the stage at the top right")
stage.wait(4)
text.set_text("I am back by using a sprite.go_to(0,0)")
# Move the sprite back to center
sprite.go_to(0,0)
stage.wait(5)
text.set_text("")
#__________________________________________________
#
# Menu of what you find in the program
#
#__________________________________________________
stage.wait(1)
sprite.hide()
stage.set_background_color("white")
heading = codesters.Text("HOW TO RELOCATE A MISSING SPRITE",0,175)
heading.set_color("red")
heading.set_size(1.25)
text1 = codesters.Text("Look at the Code:",0,120)
text1.set_color("#14a4dd")
text1.set_size(1.25)
text2 = codesters.Text("Example 1 - Add a Sprite and move off stage",0,80)
text3 = codesters.Text("Example 2 - Return the Sprite to the stage ",0,40)
text4 = codesters.Text("Where did your Sprite go?",0,-50)
text4 = codesters.Text("Debug your program and fix the code that caused",0,-70)
text4 = codesters.Text(" your sprite to move off stage",0,-90)
text5 = codesters.Text("ACTIONS Toolkit - MOVING SPRITES",0,-170)
text5.set_size(.8)
-
Run Code
-
-
Stop Running Code
-
Show Chart
-
Show Console
-
Codesters How To (opens in a new tab)