Quote: "What's a mouse positive edge? This sounds suspiciously handy if it means what I think it means."
The term "positive edge" is derived from electronics in the field of digital signal processing.
Basically, if you were to plot the value of mouseclick() over time when a user clicks, you'd get something like the following, where each vertical line represents one execution of the DBP main loop.
The
positive edge is on the left side where the signal rises to become a binary "1". There is also a negative edge, which is on the right side where the signal falls to being a become "0".
In order to detect a positive edge, you require at least two sample points. I did this by saving an old state, delaying the signal by one loop:
Let
c be the current mouse state (green) and
o be the old mouse state (blue), a positive edge
p exists when
c&~o, and a negative edge
n exists when
~c&o, where ~ represents an inversion of all bits and & represents a bitwise AND operation.
Plotting
p and
n over time results in the following:
mouseclick() encodes button presses as "1" for left-click, "2" for right-click and "4" for middle click. Those familiar with bitwise operators will already know that these are single bits which when OR-ed together slot perfectly next to each other, i.e. 1||2||4 = 7, or %001||%010||%100 = %111.
My example takes advantage of these facts, and processes the positive edge for all 3 buttons
at the same time.
I neatened it up a little and posted it on the code snippets board:
http://forum.thegamecreators.com/?m=forum_view&t=211243&b=6&p=0
Your dungeon has been arrested by a signature image because it tried to be a mod