
-----------------------------------
chroncile
Wed Dec 10, 2008 11:22 pm

Can't get mousewait to work :(
-----------------------------------
Hi, I have another assignment and I'm suppose to make a game using mousewait and this is my code so far:



%  Declares Integers
% x: Where the user has clicked - x coordinate
% y: Where the user has clicked - y coordinate
% button: determine whether the mouse has been clicked or
% not and which button has been clicked
% x1, y1, x2, and y2 are randomized integers for a box
% c1 is a randomized integer for colour
var x, y, button : int
var x1, y1, x2, y2, c1 : int

% Display a message
put "Click the box to win!"

loop
    cls
    randint (x1, 30, 75)
    randint (y1, 30, 75)
    randint (x2, 30, 75)
    randint (y2, 30, 75)
    randint (c1, 1, maxcolour)
    drawfillbox (x1, y1, x2, y2, c1)
    mousewhere (x, y, button)
    exit when button = 1 and x >= x1 and x = y1 and y = x1 and x = y1 and y = x1 and x = y1 and y = x1 and x = y1 and y 