Difference between revisions of "Simple Game of Pong"

From dftwiki3
Jump to: navigation, search
(Created page with "--~~~~ ---- * This is a quick game of pong written in [http://processing.org Processing]. <source lang="java"> int width = 600; int height = 400; int ballX = width/2; int ball...")
 
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
* This is a quick game of pong written in [http://processing.org Processing].
 
* This is a quick game of pong written in [http://processing.org Processing].
 
+
<onlydft>
 
<source lang="java">
 
<source lang="java">
 +
// pong.pde
 +
// D. Thiebaut
 +
// Processing
 +
// Defines a ball and a paddle.  The ball moves on the screen with directions dirX and dirY
 +
// and bounces off the walls and off the paddle, if it hits it.
 +
// The paddle moves only in a fixed vertical axis and its position is controlled by the mouse.
 +
//
  
 
int width = 600;
 
int width = 600;
Line 48: Line 55:
 
   fill( 255 );
 
   fill( 255 );
 
   stroke( 255 );
 
   stroke( 255 );
   ellipse( ballX, ballY, radius, radius );
+
   ellipse( ballX, ballY, radius*2, radius*2 );
 
    
 
    
 
   //--- draw paddle ---
 
   //--- draw paddle ---
Line 57: Line 64:
  
 
</source>
 
</source>
 
+
</onlydft>
 
<br />
 
<br />
  

Latest revision as of 09:58, 22 November 2011

--D. Thiebaut 22:13, 21 November 2011 (EST)


  • This is a quick game of pong written in Processing.

...