home *** CD-ROM | disk | FTP | other *** search
- #include <graph.h>
- #include <games.h>
-
- void _ball(void);
- void _dac(void);
- void _face(void);
-
- int x1=0,y1=0,dx1=4,dy1=4,x2=30,y2=10,dx2=4,dy2=2,x3=60,y3=20,dx3=2,dy3=4,x4=90,y4=30,dx4=2,dy4=2;
- int count1,count2,count3,vscreen,dac,ball,background,step;
- int jx,jy,jpress1,jpress2,jxcenter,jycenter,face1,face2,face3,fx=150,fy=65;
- int mscreen=40960;
-
- main()
- {
-
- step=10;
- vscreen=_amem(4000);
- background=_amem(3000);
- dac=_amem(539);
- ball=_amem(95);
- face1=_amem(56);
- face2=_amem(56);
- face3=_amem(56);
-
- _setvideomode(_MRES256COLOR);
- _outtext("Make sure your joystick is centered.");
- _settextposition(25,0);
- _outtext("Press left mouse button to exit");
- jxcenter=_stickx();
- jycenter=_sticky();
- LoadPCX("rocks.pcx",vscreen);
- _getv(0,0,320,150,background,vscreen,320);
- _getv(24,150,38,38,ball,vscreen,320);
- _getv(68,150,28,28,face1,vscreen,320);
- _getv(98,150,28,28,face2,vscreen,320);
- _getv(128,150,28,28,face3,vscreen,320);
- LoadPCX("dom1.pcx",vscreen);
- _getv(0,0,154,56,dac,vscreen,320);
- _showpointer();
-
- while (_getbuttondown()!=1 && kbhit()==0)
- {
- _screencopy(background,vscreen,24000);
- _ball();
- _dac();
- _face();
- _putv(0,25,320,150,vscreen,mscreen,320);
-
- }
-
- _damem(vscreen);
- _damem(background);
- _damem(dac);
- _damem(ball);
- _damem(face1);
- _damem(face2);
- _damem(face3);
- _setvideomode(_DEFAULTMODE);
- }
-
- void _ball(void)
- {
- x1=x1+dx1;
- y1=y1+dy1;
-
- if (x1>280)
- dx1=-step,x1=x1+dx1;
- if (x1<0)
- dx1=step,x1=x1+dx1;
- if (y1>110)
- dy1=-step,y1=y1+dy1;
- if (y1<0)
- dy1=step,y1=y1+dy1;
-
- x2=x2+dx2,y2=y2+dy2;
- if (x2>280)
- dx2=-step,x2=x2+dx2;
- if (x2<0)
- dx2=step,x2=x2+dx2;
- if (y2>110)
- dy2=-step,y2=y2+dy2;
- if (y2<0)
- dy2=step,y2=y2+dy2;
-
- x3=x3+dx3,y3=y3+dy3;
- if (x3>280)
- dx3=-step,x3=x3+dx3;
- if (x3<0)
- dx3=step,x3=x3+dx3;
- if (y3>110)
- dy3=-step,y3=y3+dy3;
- if (y3<0)
- dy3=step,y3=y3+dy3;
-
- x4=x4+dx4,y4=y4+dy4;
- if (x4>280)
- dx4=-step,x4=x4+dx4;
- if (x4<0)
- dx4=step,x4=x4+dx4;
- if (y4>110)
- dy4=-step,y4=y4+dy4;
- if (y4<0)
- dy4=step,y4=y4+dy4;
-
- _spritev(x1,y1,38,38,ball,vscreen,320,0);
- _spritev(x2,y2,38,38,ball,vscreen,320,0);
- _spritev(x3,y3,38,38,ball,vscreen,320,0);
- _spritev(x4,y4,38,38,ball,vscreen,320,0);
- }
-
- void _dac(void)
- {
- _spritev(83,47,154,56,dac,vscreen,320,0);
- }
-
- void _face(void)
- {
- jx=_stickx();
- jy=_sticky();
-
- if (jx>jxcenter+5 && fx<290)
- fx=fx+8;
- if (jx<jxcenter-5 && fx>8)
- fx=fx-8;
- if (jy>jycenter+5 && fy<120)
- fy=fy+8;
- if (jy<jycenter-5 && fy>8)
- fy=fy-8;
-
- if (_button1()==1)
- {
- _spritev(fx,fy,28,28,face2,vscreen,320,0);
- return;
- }
-
- if (_button2()==1)
- {
- _spritev(fx,fy,28,28,face3,vscreen,320,0);
- return;
- }
-
- _spritev(fx,fy,28,28,face1,vscreen,320,0);
- }
-
-