Lingo: Boolean Logic & Big Cursor

File "arttest.dir"

System cursors are cool, but very restricted in size and color. What if you want to have your very own cursor, colorful and big (like a pencil that you would use in order to take a multiple choice test)?

You can simulate such a cursor by having a cast member "stick" to the tip of the cursor after hiding the system cursor. For more realistic impression we can offset the simulated cursor (like the pencil we mentioned).

First you have to hide the regular cursor temporarily.

 
on startMovie
  global result
  result = 0
  cursor 200 -- hide cursor so that the tip of the pencil becomes the cursor
end
 
on stopMovie
  cursor -1 -- back to mouse pointer
end

Now, while you are at that frame, you can have your own cursor follow the mouse - like with the cursor chase example. But for simulating a pencil there is a catch: You want to check the checkboxes with the answers with the tip of the pencil. But the locV and locH will give you the coordinates of the registration point. So, you need to offset the pencil so that the cursor is at its lower left corner.

 
--HandleChase:
on HandleChase -- sprite 8 is the pencil. 
  sprite(16).locH = _mouse.mouseH + 60  -- push pencil to the right
  sprite(16).locV = _mouse.mouseV - 75  -- and up, so it is at the tip of the mouse
end HandleChase

To find the exact coordinates, select the mouse cursor and check the difference between registration point and lower left corner of the enclosing rectangle, that is, between X and L(eft), and Y and B(ottom) in the sprite properties.

Boolean Logic

The application as it standschecks the correctness of Q1 on the test. To see if a checkbox is selected, you test to see if its hilite property is true. This can be done in an if-statement:

 
on mouseUp 
  if sprite(9).selected then 
    alert "good job"
  else 
    alert "you fail"
  end if
end

This is not correct, though: Only answer a (sprite 9) is correct and should be selected. The other two answers (sprites 10 and 11) should not be selected for the first question to get the "good job" comment.

Q How would you correct the code to evaluate correctly the first question?

Q. Create checkbox responses for the other two questions. Then augment the code so that it evaluates all three questions of the exam.

 

 

Maintained By: Takis Metaxas
Last Modified: November 11, 2009