/* AntiRight (c) 2003-2005 Jeffrey Bedard antiright@gmail.com This file is part of AntiRight. AntiRight is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. AntiRight is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with AntiRight; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "pongr.h" void raise_height() { if(ball_y>0) { ball_y=ball_y-rand()/100000000; } } void lower_height() { if(ball_y<182) { ball_y=ball_y+rand()/100000000; } } void refresh_text() { draw_court(); if(score<-48) { loseflag=True; game_over=True; xprint(128,128,"GAME OVER"); } else if(score>48) { game_over=True; xprint(128,128,"YOU WIN!"); } draw_wall_fire(); } void compute_ball() { int flag1=0; if(ball_x>252) { if(paddle_posball_y) score++; else score--; flag1=True; ball_direction=LEFT; } else if(ball_x<2) { if(paddle_posball_y ) score++; else score--; flag1=True; ball_direction=RIGHT; } else if(ball_direction==0) { if(flag1==False) { ball_direction=RIGHT; } } ball_x=ball_x+ball_direction; raise_height(); lower_height(); flag1=False; } void paddle_up() { if(paddle_pos>0) { if(paddle_pos<180) { paddle_pos=paddle_pos-8; } else { paddle_pos=paddle_pos-8; }; } else { paddle_pos=paddle_pos+8; } draw_paddle(); } void paddle_down() { if(paddle_pos>0) { if(paddle_pos<180) { paddle_pos=paddle_pos+8; } else { paddle_pos=paddle_pos-8; } } else { paddle_pos=paddle_pos+8; } draw_paddle(); }