#define SAVE_SCREEN #define USE_GRAY_PATCH #define OPTIMIZE_ROM_CALLS #include <tigcclib.h> short _ti89; static unsigned int rand_seed=0; // seed for random numbers int randomnum(int x) // returns a random number between 0 and x-1 { return (rand_seed=(75*rand_seed+1))%x; } void da(void) { GrayMode (GRAY_ON); SetPlane (0); ClrScr ( ); BitmapPut (0, 0, &arena_C0, &zone_clip, A_NORMAL); SetPlane (1); ClrScr ( ); BitmapPut (0, 0, &arena_C1, &zone_clip, A_NORMAL); ngetchx ( ); GrayMode (GRAY_OFF); clrscr(); } void end(void) { clrscr(); DrawStr(0,0,"Score :",A_REPLACE); ngetchx(); } void _main(void) { short timing=32000; short yesno=0; short rep=18; short sc=0; short i=0; GrayMode (GRAY_ON); SetPlane (0); ClrScr ( ); BitmapPut (0, 0, &titre_C0, &zone_clip, A_NORMAL); SetPlane (1); ClrScr ( ); BitmapPut (0, 0, &titre_C1, &zone_clip, A_NORMAL); ngetchx ( ); GrayMode (GRAY_OFF); clrscr(); da(); i=0; clrscr(); yesno=randomnum(2); if (yesno == 0) DrawStr(0,0,"Yes it is ! ",A_REPLACE); if (yesno == 1) DrawStr(0,0,"No, it isn't !",A_REPLACE); if (_rowread(0x7E)&0x2) { DrawStr(0,50,"Yes it is ! ",A_REPLACE); rep=0; i=32001; } if (_rowread(0x7E)&0x8) { DrawStr(0,50,"No, it isn't !",A_REPLACE); rep=1; i=32001; } }
Voilà, ce prog affiche deux images en 4 NVG (je vous ai soulagés des codes) et ensuite passe au "jeu" (qui ne sera pas ainsi, rassurez-vous). Je voudrais savoir comment on fait une boucle qui :
- Suivant la valeur de yesno, affiche "Yes, it is", ou "No, it isn't".
- Le prog attende qu'on appuie sur gauche ou droite, et augmente le score si on contredit ce qui est écrit,
- si on ne réagit pas, la calto affiche "Thank you !", puis le score.
Merci d'avance.
