1 
  2 function paddle(x, y, imageorsize, color){
  3 this.x = x;
  4 this.y = y;
  5 this.size;
  6 this.image;
  7 this.traj = 0;
  8 if(typeof imageorsize ==='string'){
  9 	this.image = LoadSurface(imageorsize);
 10 	this.size = this.image.width;
 11 	}
 12 	else{
 13 	this.image = CreateSurface(imageorsize, 16, CreateColor(0,0,0,0))
 14 	this.image.filledCircle(8, 8, 8, color, false)
 15 	this.image.filledCircle(this.image.width-8, 8, 8, color, false)
 16 	this.image.rectangle(8, 0, this.image.width-16, 16, color)
 17 	this.size = imageorsize;
 18 	}
 19 
 20 this.blit = function(){this.image.blit(this.x,this.y)}
 21 this.move = function(){this.x+=this.traj; this.traj/=1.1; this.traj = Math.round(this.traj*10)/10; if(Math.abs(this.traj)==0.5){this.traj = 0}; if(this.x<0){this.x=0; this.traj = 0;}; if(this.x+this.size>GetScreenWidth()){this.traj = 0;this.x=GetScreenWidth()-this.size}}
 22 this.gettrajmod = function(object){var qx = object.x-(this.x+8); return qx/(this.size*2)}
 23 }
 24 
 25 function processPaddles(){
 26 var i = 0;
 27 	while(i<paddles.length){
 28 	paddles[i].blit();
 29 	paddles[i].move();
 30 	if(IsKeyPressed(KEY_RIGHT)){paddles[i].traj++; if(paddles[i].traj>6)	{paddles[i].traj=6	}}
 31 	if(IsKeyPressed(KEY_LEFT)){paddles[i].traj--; if(paddles[i].traj<-6)	{paddles[i].traj=-6	}}
 32 
 33 	i++
 34 	}
 35 }
 36 
 37 function reload(){
 38 balls.push(new ball(0, 0, 0, 4, 1, 16, White))
 39 balls[balls.length-1].lockedtopaddle=true
 40 }