Pong em c

Disponível somente no TrabalhosFeitos
  • Páginas : 2 (292 palavras )
  • Download(s) : 0
  • Publicado : 30 de abril de 2012
Ler documento completo
Amostra do texto
Pong em C


/*Include the pong header file for the finding things in the datafile*/
#include "pong.h"

#define pong_ball 0 /*RLE */
#define pong_bar 1 /* RLE */
#define pong_boing 2 /* SAMP */
#define pong_pal 3 /* PAL */#define pong_text 4 /* FONT */
#define pong_COUNT 5

/*Direction consts*/
#define DOWN_RIGHT 0
#define UP_RIGHT 1
#define DOWN_LEFT 2#define UP_LEFT 3

/*Get the Pong DataFile*/
DATAFILE *pong_datafile=NULL;

/*Game variables*/
int bar1_y=30; //Player 1 Bar position
int bar2_y=430; //Player 2 Bar position

intball_x; //The location of the Ball
int ball_y; //The location of the Ball
int direction=0; //The direction the Ball is going

int score_p1=0; //Player 1 score
intscore_p2=0; //Plater 2 score

BITMAP *buffer; //The screen buffer of double buffering

int speed=2; //The speed of the Ball

int amout_of_hits=0; //Used to set the speed of theBall

int up_ran_speed=0; //Random speed

*NAME:Boing *
*PURPOSE:To play the sound file whenthe ball is hit *
*******************************************************/void boing(void)

*NAME:Random Direction*
*PURPOSE:To send back a random direction for the ball *
*RETURN: An int for the direction *...
tracking img