我用的是 Borland Pascal 7.0,我想做一个老虎机游戏(如果 3 个随机数相同,你就赢了)。问题是当我单击菜单上的开始(Inditas)按钮时,该过程会执行多次,直到我松开鼠标按钮。有人告诉我,我应该在执行一次程序之前检查鼠标按钮是否被释放。我怎样才能做到这一点?这是菜单的样子:
procedure eger;
begin;
mouseinit;
mouseon;
menu;
repeat
getmouse(m);
if (m.left) and (m.x>60) AND (m.x<130) and (m.y>120) and (m.y<150) then
teglalap(90,90,300,300,blue);
if (m.left) and (m.x>60) AND (m.x<130) and (m.y>160) and (m.y<190) then
jatek(a,b,c,coin,coins);
until ((m.left) and (m.x>60) AND (m.x<130) and (m.y>240) and (m.y<270));
end;
谢谢,罗伯特