# Can someone help me with collision?

**URL:** <https://forum.kirupa.com/t/can-someone-help-me-with-collision/229249>\
**Category:** Uncategorized\
**Created:** [June 15, 2007, 6:05am UTC](https://forum.kirupa.com/t/can-someone-help-me-with-collision/229249 "2007-06-15T06:05:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Icezizim](https://avatars.discourse-cdn.com/v4/letter/i/b9e5f3/32.png) [@Icezizim](https://forum.kirupa.com/u/Icezizim)\
**Post date:** [June 15, 2007, 6:05am UTC](https://forum.kirupa.com/t/can-someone-help-me-with-collision/229249/1 "2007-06-15T06:05:43Z")

</div>

well just within the last month iv picked up actionscript and im trying to make a simple platform game from scratch. well i couldnt get a floor to work. i was using hitTest but it never works right, like: if(hero.hitTest(wall)) {yspeed=0} . i have a static ground right now. but i want to take that out and just make the ground a collision thing that stops the hero MC. so can someone please edit this to make the mc “hero” stop of hitTest with another mc, just call it “wall”. oh and this code was all written to work on the first frame of \_root, i just think its easier to edit when its all there. thanks

```php

gravity=2 
ground=300 
power=20 
onEnterFrame=function(){ 
     yspeed-=gravity 
     hero._y-=yspeed 
     if(hero._y>ground){ 
          yspeed=0 
          hero._y=300 
          jumping=false 
     } 
     if(Key.isDown(Key.LEFT)){ 
          hero._x-=5; 
          hero._xscale=-100; 
          hero.gotoAndStop("walkright"); 
     } 
     else if(Key.isDown(Key.RIGHT)){ 
          hero._x+=5; 
          hero._xscale=100; 
          hero.gotoAndStop("walkright"); 
     } 
     else{ 
          hero.gotoAndStop("herostop"); 
     } 
     if(Key.isDown(Key.UP)){ 
          if(!jumping){ 
               yspeed=power 
               jumping=true 
          } 
     } 
      
}

```
