PDA

View Full Version : Submission: Pong



Ben H
January 15th, 2006, 02:27 PM
Bang on 25!

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

Sammo
January 15th, 2006, 03:07 PM
haha, damn beat me to it! *closes flash*

Ben H
January 15th, 2006, 03:25 PM
:lol:

I'm lucky seb didn't steal it 'cause I told him on MSN when I came up with it :P

-Ben

bombsledder
January 15th, 2006, 05:24 PM
i call breakout lol XD

kdd
January 15th, 2006, 07:01 PM
that's good...
edit: is there a limit on # of tries? oh, i saw it's 25 lines...

hybrid101
January 16th, 2006, 06:44 AM
damn, same here, you beat me to it...oh well...nice one btw!

Sammo
January 16th, 2006, 01:40 PM
} //24

^^^ not a line :)

Add a Stage.scaleMode = "noScale"; now!