[AS2] Platform codes - game
Ok, im currently creating a small platformer in flash. It's standard concept, e.g moving platforms. Up to yet i have used one horizontal moving platform which worked perfectly fine. Here's the code:
onClipEvent (load) {
maxMove = 100;
maxX = _x + maxMove;
minX = _x;
moving = 3;
}
onClipEvent (enterFrame) {
if (this.hitTest (_root.hero)) {
_root.hero._y -= 1;
_root.hero._x += moving;
}
_x += moving;
if (_x >= maxX || _x < minX) {
moving = -moving;
}
}
I didn't code this. Although i do understand it. To make the game different i decided to make some platforms move vertical. I was puzzled when i changed the code above to a vertical moving code. The actual platform moved perfectly just as i predicted, the only problem was that the character was limited to how long he could stay on the platform. He would land and then suddenly appear somewhere of the platform. I'm very annoyed with this because i thought the production of my game would be more fluent. If anybody has any suggestions please let me know.
Cheers. Danny
|