# Box Pushing in AS2

**URL:** <https://forum.kirupa.com/t/box-pushing-in-as2/637310>\
**Category:** flash\
**Created:** [October 15, 2017, 2:50pm UTC](https://forum.kirupa.com/t/box-pushing-in-as2/637310 "2017-10-15T14:50:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbpanzu](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bbpanzu](https://forum.kirupa.com/u/bbpanzu)\
**Post date:** [October 15, 2017, 2:50pm UTC](https://forum.kirupa.com/t/box-pushing-in-as2/637310/1 "2017-10-15T14:50:10Z")

</div>

I’m trying to make my character push a box, but all the box is doing is sticking onto the character. I know why it’s doing it, I just don’t know how to fix it.

_code:_

* * *

`if(this.hitTest(_root.char)){
_x += _root.xSpeed;
}else{
_x += 0;
} `

* * *

Help is much appreciated

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [October 15, 2017, 2:56pm UTC](https://forum.kirupa.com/t/box-pushing-in-as2/637310/2 "2017-10-15T14:56:59Z")

</div>

Why is it doing it?

---

<div class="post-metadata">

**Author:** ![bbpanzu](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bbpanzu](https://forum.kirupa.com/u/bbpanzu)\
**Post date:** [October 15, 2017, 3:02pm UTC](https://forum.kirupa.com/t/box-pushing-in-as2/637310/3 "2017-10-15T15:02:49Z")

</div>

i tell it when the character is touching it, move xSpeed. the problem is that if the char is moving the opposite direction, the box will stick with it because if the char’s xSpeed += -4, then the box’s xSpeed += -4.

---

<div class="post-metadata">

**Author:** ![bbpanzu](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bbpanzu](https://forum.kirupa.com/u/bbpanzu)\
**Post date:** [October 15, 2017, 3:02pm UTC](https://forum.kirupa.com/t/box-pushing-in-as2/637310/4 "2017-10-15T15:02:57Z")

</div>

nvm i got it now
