# I have done it! A platform Game!

**URL:** <https://forum.kirupa.com/t/i-have-done-it-a-platform-game/175594>\
**Category:** contests\
**Created:** [January 16, 2006, 6:46am UTC](https://forum.kirupa.com/t/i-have-done-it-a-platform-game/175594 "2006-01-16T06:46:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [January 16, 2006, 6:46am UTC](https://forum.kirupa.com/t/i-have-done-it-a-platform-game/175594/1 "2006-01-16T06:46:38Z")

</div>

entry #3 woot!!! so happy:D

```auto

var k = _root.createEmptyMovieClip("square", l00);
k.beginFill(0xFF0000);
k.moveTo(0, -5);
kpt = new Array({x:0, y:-5}, {x:0, y:5}, {x:5, y:5}, {x:5, y:-5});
for (var e = 1; e<kpt.length; e++) {
 k.lineTo(kpt[e].x, kpt[e].y);
}
k._y = Stage.height/2;
k._x = Stage.width/2;
pts = new Array({x:23, y:100},{x:46, y:100},{x:46, y:333}, {x:233, y:333}, {x:290.9, y:273}, {x:480, y:332.4}, {x:620, y:266}, {x:620, y:230}, {x:641, y:230}, {x:641, y:176}, {x:681, y:176},{x:681, y:250}, {x:740, y:335},{x:900, y:335},{x:900, y:100},{x:940, y:100},{x:940, y:381}, {x:23, y:382}, {x:23, y:100});
_root.createEmptyMovieClip("plat", -1);
plat.lineStyle(10);
for (var i = 1; i<pts.length; i++) {
 plat.moveTo(pts[i-1].x, pts[i-1].y);
 plat.lineTo(pts*.x, pts*.y);
}
onEnterFrame = function () {
 plat.hitTest(square._x, square._y, true) ? jumping=false : square._y += 8;
 while (plat.hitTest(square._x, square._y, true)) {
  square._y--;
 }
 Key.isDown(Key.UP) && !jumping ? jump=-20 : null;
 Key.isDown(Key.UP) && !jumping ? jumping=true : null;
 jumping ? jumping=true : null;
 jumping ? square._y += (jump++) : null;
 Key.isDown(Key.LEFT) && !plat.hitTest(square._x-10, square._y-20, true) ? plat._x += 5 : null;
 Key.isDown(Key.RIGHT) && !plat.hitTest(square._x+10, square._y-20, true) ? plat._x -= 5 : null;
};

```

Let me know what u think
