# Sprites only bouncing one time

**URL:** https://forum.code.org/t/sprites-only-bouncing-one-time/31849
**Category:** CS Fundamentals (CSF) (K-5)
**Created:** [December 5, 2019, 5:11pm UTC](https://forum.code.org/t/sprites-only-bouncing-one-time/31849 "2019-12-05T17:11:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jmarsman](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jmarsman](https://forum.code.org/u/jmarsman)
#### Post date: [December 5, 2019, 5:11pm UTC](https://forum.code.org/t/sprites-only-bouncing-one-time/31849/1 "2019-12-05T17:11:25Z")

</div>

Hello, hopefully someone can help me. One of my students created a tennis game and the game begins fine with the ball (a sprite) “moving ten pixels north”.

When the ball “touches” the player (another sprite) the ball begins bouncing 25 pixels south".

When the ball "touches: the other player (different sprite) the ball begins bouncing north again.

At this point however, the next time the ball touches the player sprite, it should bounce back south again, but it is not bouncing back, resulting in game over.

Please help…here is the link to thegame:

> **[Check out what I made](https://studio.code.org/projects/spritelab/3xEcXbx6Gp7OeHusIJQNZoStPQtfhlYCkhKWvgl9fhw)**
>
> I wrote the code myself with Code.org

Thank-you…

---

<div class="post-metadata">

### Author: ![mike](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mike/32/5229_2.png) [@mike](https://forum.code.org/u/mike)
#### Post date: [December 9, 2019, 4:45pm UTC](https://forum.code.org/t/sprites-only-bouncing-one-time/31849/2 "2019-12-09T16:45:40Z")

</div>

Hi Mr. Marsman,  
The issue here is that a sprite can actually have multiple behaviors at once. Beginning one behavior doesn’t automatically stop the others.  
At the start of the game, the ball is `moving north or south` which means _up by 10 pixels_.  
After it hits the top player, the ball is `moving north or south` and `bouncing south` which means it’s moving _up by 10 pixels_ and _down by 25 pixels_ at the same time. What we see is the ball moving down.  
Finally after hitting the bottom player, the ball has all 3 behaviors. It’s going to move _up by 10_, _down by 25_, and _up by 25_. We’ll see the ball just keep moving up forever (until game over).  
A solution to this problem is to make sure to stop any current behaviors before starting a new one. An example of this would be the following:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/1/12b966fdda4e22fd70013160962e6ecb7fb521f0.png)  
If the student goes with this solution, they’d probably want to add the block to any place where a new behavior is beginning, just to be safe.

---

<div class="post-metadata">

### Author: ![jmarsman](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jmarsman](https://forum.code.org/u/jmarsman)
#### Post date: [December 9, 2019, 5:41pm UTC](https://forum.code.org/t/sprites-only-bouncing-one-time/31849/3 "2019-12-09T17:41:50Z")

</div>

Thank-you! That was it - it’s working now…
