Help with platform game

Hi all,

I am new to this board but have been looking over the tutorials and boards for years now. I only know some limited actionscript. I have an assignment in school to make a scrolling platform game and I only have 6 weeks to do it in. I only need 1 level for class, but would like to make multiple ones for my own endeavors. In trying to make a game, I have ran into many problems but have overcame some of them, but now am kinda stuck and could use some help from the experts out there. I realize my coding is sloppy and am working to clean it up. I would appreciate any suggestions of how to do things to where they will work better/more reliable. Some problems I am having are not limited to but include:

  • After jumping, the “hero” does not always stop at the same point on the ground when landing.

  • I have tried many ways to do platforms and have had no luck. Detecting when he lands on them versus is just pushed up against a block or platform and cannot go any further.

  • Scrolling the platforms in a full stage scene.

  • I have buttons to stop and start scrolling, if the character is to the right of the scrollpoint and you turn scrolling back on, it just jumps to the point where he is in the middle instead of scrolling smoothly. The background also does not always align properly…especially when reaching the end of the movieclip that scrolls it.

There is probably more, but that is all I can think of right now. The graphics suck right now and the background is just a wallpaper I have for my desktop until the real graphics are ready.

The swf is here:
http://home.ripway.com/2005-5/315831/action10.swf

FLA to mess with is here:
http://home.ripway.com/2005-5/315831/action10.fla

Coding I have so far:

in first frame to set up variables:

_root.lockscroll = 1; //1 = scrolling on, 2 = scrolling off
_root.howfast = 10; //Walkspeed
_root.walking = 1; //Toggle - 1 = standing, 2 = right facing walk, 3 = left facing walk
_root.jump = 1; //1 = on ground, 2 = in a jump going up, 3 = falling
_root.jumpH = 130; //How high you jump
_root.midjump = 80; //How high the midjump is - minimum jump
_root.jumpS = 15; //How fast you jump
_root.upheld = 1; //Determines if UP key is being held down - 1 = no, 2 = yes
_root.jumpvalue = 0; //Temp spot to hold jump calculations
_root.jumpvalue2 = 0; //Another temp jump caculation spot

on the hero movieclip:

onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_root.facing = 2;
if (this._x>50) {
this._x -= _root.howfast;
if (_root.jump == 1) {
if (_root.walking == 1 or _root.walking == 2) {
_root.walking = 3;
_root.hero.gotoAndPlay(“left”);
} else if (_root.walking == 3) {
_root.hero.nextFrame();
}
}
} else {
_root.hero.gotoAndStop(3);
}
} else if (Key.isDown(Key.RIGHT)) {
_root.facing = 1;
if (_root.lockscroll == 1) {
if (this._x<300) {
if (this._x>250) {
this._x -= _root.howfast;
_root.back.nextFrame();
_root.back2.nextFrame();
_root.back2.nextFrame();
_root.back3.nextFrame();
_root.back3.nextFrame();
_root.back3.nextFrame();
}
this._x += _root.howfast;
if (_root.jump == 1) {
if (_root.walking == 1 or _root.walking == 3) {
_root.walking = 2;
_root.hero.gotoAndPlay(“right”);
} else if (_root.walking == 2) {
_root.hero.nextFrame();
}
}
}
} else if (_root.lockscroll == 2) {
if (this._x<550) {
this._x += _root.howfast;
if (_root.jump == 1) {
if (_root.walking == 1 or _root.walking == 3) {
_root.walking = 2;
_root.hero.gotoAndPlay(“right”);
} else if (_root.walking == 2) {
_root.hero.nextFrame();
}
}
} else {
_root.hero.gotoAndStop(1);
}
}
} else {
if (_root.facing == 1) {
_root.walking = 1;
if (_root.jump == 1) {
_root.hero.gotoAndStop(1);
}
} else if (_root.facing == 2) {
_root.walking = 1;
if (_root.jump == 1) {
_root.hero.gotoAndStop(3);
}
}
}
}
onClipEvent (enterFrame) {
_root.upheld = 1;
if (Key.isDown(Key.UP)) {
_root.upheld = 2;
if (_root.jump == 1) {
_root.jump = 2;
_root.jumpvalue = _root.hero._y-_root.jumpH;
_root.jumpvalue2 = _root.hero._y-_root.midjump;
_root.gravity = _root.jumpS
}
}
if (_root.jump == 2) {
if (_root.facing == 1) {
_root.hero.gotoAndStop(“jumpR”)
} else if (_root.facing == 2) {
_root.hero.gotoAndStop(“jumpL”)}
if (_root.upheld == 2) {
if (_root.hero._y>_root.jumpvalue) {
if (_root.gravity > 1) {
_root.gravity-=.8}
_root.hero._y -= _root.gravity;
} else {
_root.jump = 3;}
} else {
if (_root.hero._y>_root.jumpvalue2) {
if (_root.gravity > 1) {
_root.gravity-=1.2}
_root.hero._y -= _root.gravity;
} else {
_root.jump = 3;}
}
}
}

onClipEvent (enterFrame) {
if (_root.jump==1) {
if (_root.hero.hitTest(_root.ground) == false) {
_root.hero._y = _root.hero._y+_root.jumpS;}

 } else if (_root.jump==3) {
     if (_root.hero.hitTest(_root.ground) == false) {
         if (_root.gravity &lt; _root.jumpS) {
             _root.gravity+=1}
         _root.hero._y = _root.hero._y+_root.gravity;
     } else {
         _root.jump = 1;
     }
 }

}

Thanks again and any help is appreciated.