Hola once more.
Got a big set of loops and if's going on, but I only want the end product of them to happen when the player left clicks only once (rather than them being able to hold down the mouse button).
I thought this would have been as easy as setting a holddown flag, and when holddown = 1, don't execute certain code, and when mouseclick() = 0, holddown = 0, and executing certain code is allowed.
Here's that concept in practice in my code:
REM Check for correct clicks
if mouseclick()=1
sprite spritemouse,mousex(),mousey(),mousepointer
for i = 1 to 5
if sprite exist(i) = 1 and sprite exist(spritemouse) = 1
if sprite collision(spritemouse,i) = 1
if holddown = 0
tip = tip + (0.05*remain)
price = price + drinks(order(i)).drinkprice
total = tip + price
delete sprite i
inc ordersdone
holddown = 1
endif
endif
endif
next i
delete sprite spritemouse
endif
REM If they're not holding down the mouse,
REM release the holddown check
if mouseclick() = 0 then holddown = 0 else holddown = 1
But no luck. The player can still hold down the left mouse button and achieve what I only want them to be able to do when there's only a single click. Tried playing about with the placement of the holddown if but I'm apparently getting nowhere.
Help is, as always is, appreciated in advance.