# Submission: Pong

**URL:** <https://forum.kirupa.com/t/submission-pong/175548>\
**Category:** contests\
**Created:** [January 15, 2006, 6:27pm UTC](https://forum.kirupa.com/t/submission-pong/175548 "2006-01-15T18:27:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_H](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ben_h/32/939_2.png) [@Ben\_H](https://forum.kirupa.com/u/Ben_H)\
**Post date:** [January 15, 2006, 6:27pm UTC](https://forum.kirupa.com/t/submission-pong/175548/1 "2006-01-15T18:27:08Z")

</div>

Bang on 25!

```auto
Mouse.hide();//1
scoreval = 0;//2
function square (x1,y1,x2,y2,objnum) {
    objs[objnum].beginFill(0x000000);//3
    objs[objnum].moveTo(x1,y1);//4
    objs[objnum].lineTo(x2,y1);//5
    objs[objnum].lineTo(x2,y2);//6
    objs[objnum].lineTo(x1,y2);//7
    objs[objnum].lineTo(x1,y1);//8
}
objs = [createEmptyMovieClip("paddle",_level0), createEmptyMovieClip("ball", 3), createTextField("score",9,5,5,60,50)];//9
square(0,0,100,1,0);//10
objs[0]._y = Stage.height - objs[0]._height - 20;//11
objs[0].onEnterFrame = function() { this._x = _root._xmouse - (this._width/2); }//12
square(0,0,15,15,1);//13
objs[1].xspeed = objs[1].yspeed = 10;//14
objs[1]._x = objs[1]._y = 5;//15
objs[1].onEnterFrame = function() {
    this._x += this.xspeed; //16
    this._y += this.yspeed;//17
    if (this._x > 539 || this._x < 10) this.xspeed = 0 - this.xspeed;//18
    if (this._y < 10) this.yspeed = 0 - this.yspeed;//19
    if (this._y > 389) { _root.scoreval = 0; this._x = this._y = 11;}//20
if (this._x > _root.objs[0]._x && this._x < _root.objs[0]._x+_root.objs[0]._width && this._y > _root.objs[0]._y-20 && this._y < 545){ //21
this.yspeed = 0 - this.yspeed;//22
scoreval++;//23
} //24
_root.score.text = "Score: "+_root.scoreval; }//25

```

-Ben
