# Help! My side scroller game has a bug! (or two)

**URL:** <https://forum.code.org/t/help-my-side-scroller-game-has-a-bug-or-two/34165>\
**Category:** Unit and Lesson Discussion\
**Tags:** csd-unit-3\
**Created:** [February 1, 2021, 5:51pm UTC](https://forum.code.org/t/help-my-side-scroller-game-has-a-bug-or-two/34165 "2021-02-01T17:51:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ekitzel](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@ekitzel](https://forum.code.org/u/ekitzel)\
**Post date:** [February 1, 2021, 5:51pm UTC](https://forum.code.org/t/help-my-side-scroller-game-has-a-bug-or-two/34165/1 "2021-02-01T17:51:10Z")

</div>

Can anyone view my code and tell me why my tapir won’t come back down after the up arrow is placed? I have been working on it all week and still can’t figure it out.

> **[Check out what I made](https://studio.code.org/projects/gamelab/uZj7fRWAw5U4p-Y4QvGKEFYFiXhW4BWikTyGQsvr5aQ)**
>
> I wrote the code myself with Code.org

---

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [February 1, 2021, 6:00pm UTC](https://forum.code.org/t/help-my-side-scroller-game-has-a-bug-or-two/34165/2 "2021-02-01T18:00:57Z")

</div>

You forgot to finish it!

```javascript
  // if the tapir reaches the top of the jump
  //go back down

  // LOOPING

```

There is some code missing.

---

<div class="post-metadata">

**Author:** ![ekitzel](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@ekitzel](https://forum.code.org/u/ekitzel)\
**Post date:** [February 1, 2021, 7:27pm UTC](https://forum.code.org/t/help-my-side-scroller-game-has-a-bug-or-two/34165/3 "2021-02-01T19:27:59Z")

</div>

Sorry I had the wrong version. I have that piece of code added, and the tapir still hangs out in the sky.

[Code.org - Game Lab](https://studio.code.org/projects/gamelab/uZj7fRWAw5U4p-Y4QvGKEFYFiXhW4BWikTyGQsvr5aQ)

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [February 2, 2021, 1:08am UTC](https://forum.code.org/t/help-my-side-scroller-game-has-a-bug-or-two/34165/4 "2021-02-02T01:08:27Z")

</div>

@ekitzel,

Did you figure it out? It appears to work for me when I check it right now.

Mike

---

<div class="post-metadata">

**Author:** ![ekitzel](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@ekitzel](https://forum.code.org/u/ekitzel)\
**Post date:** [February 2, 2021, 2:03am UTC](https://forum.code.org/t/help-my-side-scroller-game-has-a-bug-or-two/34165/5 "2021-02-02T02:03:17Z")

</div>

One of my students got the animal to come back down, now he kind of comes down too far, but it’s a lot better now.

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [February 2, 2021, 2:53am UTC](https://forum.code.org/t/help-my-side-scroller-game-has-a-bug-or-two/34165/6 "2021-02-02T02:53:55Z")

</div>

If you have a verified teacher’s account, you could check out this activity from last year’s version of the curriculum:

[https://studio.code.org/s/csd3-2019/stage/15/puzzle/11](https://studio.code.org/s/csd3-2019/stage/15/puzzle/11)

There is an exemplar on the right side teacher’s panel to show how to solve it, but the basic pseudocode is:

1. Check to see if the frog is on the ground. If he is, set his velocity to 0 (he won’t move if on the ground).
2. If the frog is on the ground, **AND** if the up key is pressed, change his velocity (- number).
3. Once he reaches a certain point in the sky, reverse his velocity (+ number)
4. Once he reaches the ground again, the 1st rule above will set the velocity to 0 and he will stop moving.

Hope this helps a bit!

Mike

---

<div class="post-metadata">

**Author:** ![ekitzel](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@ekitzel](https://forum.code.org/u/ekitzel)\
**Post date:** [February 2, 2021, 2:02pm UTC](https://forum.code.org/t/help-my-side-scroller-game-has-a-bug-or-two/34165/7 "2021-02-02T14:02:44Z")

</div>

Thank you! I will check it out!
