# Please help?

**URL:** <https://forum.kirupa.com/t/please-help/320972>\
**Category:** flash\
**Created:** [April 7, 2011, 6:55am UTC](https://forum.kirupa.com/t/please-help/320972 "2011-04-07T06:55:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheAwesomeDude](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@TheAwesomeDude](https://forum.kirupa.com/u/TheAwesomeDude)\
**Post date:** [April 7, 2011, 6:55am UTC](https://forum.kirupa.com/t/please-help/320972/1 "2011-04-07T06:55:02Z")

</div>

First of all, my english isn’t that good, so please don’t tell me about it.

Now to my question.

I have a game where the player is a ball. And when the player hits a object, (a box) the ball, should bounce back 1 step. Its a wall.

Here is my problem.  
Now its look like this:

if (Ball.hitTestObject(Wall))  
{  
Ball.x += 1;  
}

But what it says it that if it hit on the left side it should bounce one to the right. But if i hit the box on the other side it ofcourse bounce 1 to the right agian, which makes it wrong.  
I want to make it bounce Ball.x -= 1; if it’s hitting on the otherside. Which made my think of a system where its calculate the center of my box and then tells the boll like this.’

The box is 128 x 128.  
Center is then 64.

If ball hits 0 ball bounce Ball.x -=1  
If ball hits 128 ball bounce Ball.x +=1

[http://img858.imageshack.us/i/boxh.png/](http://img858.imageshack.us/i/boxh.png/)
