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

**URL:** <https://forum.code.org/t/creating-edge-sprites-in-game-lab-unit-3-lesson-18/14081>\
**Category:** CS Discoveries\
**Tags:** csd-unit-3-lesson-18\
**Created:** [February 1, 2018, 5:22pm UTC](https://forum.code.org/t/creating-edge-sprites-in-game-lab-unit-3-lesson-18/14081 "2018-02-01T17:22:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jstearns](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jstearns](https://forum.code.org/u/jstearns)\
**Post date:** [February 1, 2018, 5:22pm UTC](https://forum.code.org/t/creating-edge-sprites-in-game-lab-unit-3-lesson-18/14081/1 "2018-02-01T17:22:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![karenma](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/karenma/32/4924_2.png) [@karenma](https://forum.code.org/u/karenma)\
**Post date:** [February 9, 2018, 5:00am UTC](https://forum.code.org/t/creating-edge-sprites-in-game-lab-unit-3-lesson-18/14081/2 "2018-02-09T05:00:03Z")

</div>

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;  
}

---

<div class="post-metadata">

**Author:** ![josh](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/josh/32/868_2.png) [@josh](https://forum.code.org/u/josh)\
**Post date:** [February 9, 2018, 5:09am UTC](https://forum.code.org/t/creating-edge-sprites-in-game-lab-unit-3-lesson-18/14081/3 "2018-02-09T05:09:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sthornton](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sthornton](https://forum.code.org/u/sthornton)\
**Post date:** [January 31, 2019, 1:18pm UTC](https://forum.code.org/t/creating-edge-sprites-in-game-lab-unit-3-lesson-18/14081/4 "2019-01-31T13:18:11Z")

</div>

The example coding for Lesson 18.16 shows edge sprites, but students/teachers are not given any hints as to how to create them. This has been very frustrating for my students (and for me). This is not the first lesson/level with what I think are inadequate instructions or hints to guide students. Why can’t the edge sprites be in the toolbox?

---

<div class="post-metadata">

**Author:** ![karenma](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/karenma/32/4924_2.png) [@karenma](https://forum.code.org/u/karenma)\
**Post date:** [February 1, 2019, 4:36am UTC](https://forum.code.org/t/creating-edge-sprites-in-game-lab-unit-3-lesson-18/14081/5 "2019-02-01T04:36:37Z")

</div>

Hi Sheri  
Great question. I will forward this on to see if this could be added to the toolbox.  
Karen

---

<div class="post-metadata">

**Author:** ![stefaniem](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@stefaniem](https://forum.code.org/u/stefaniem)\
**Post date:** [February 11, 2019, 2:48pm UTC](https://forum.code.org/t/creating-edge-sprites-in-game-lab-unit-3-lesson-18/14081/6 "2019-02-11T14:48:22Z")

</div>

I agree why is it just like create with out help! I do not like this, this Edge could be a whole lesson.
