Creating edge sprites in Game Lab-Unit 3, Lesson 18


Students are having a difficult time creating edges for their games. I have read another post by someone else on the teacher forum and looked at their example. However, the example they have posted does not contain a game with edges.


Here is one way of creating edges for a game. The Sprite created is labeled: dooder . This code makes it appear that there edges on the game by not allowing the Sprite to leave the game. If you need to see the full code, just send me a message and I will post it. I don’t know if this is what you mean by “creating edges for their games”.

if (dooder.x < 0) {
dooder.velocityX = 1;
if (dooder.x > 400) {
dooder.velocityX = -1;
if (dooder.y >400) {
dooder.velocityY = -1;
if (dooder.y <0) {
dooder.velocityY = 1;


There’s also a built-in command called createEdgeSprites() that will create a group of edge sprites called edges and separate sprites for leftEdge, rightEdge, topEdge, and bottomEdge. It may not be in the toolbox during the lesson, but students can still use it in text mode or by going to full Game Lab.