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
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
}
}
}