Difference between revisions of "How to detect single mouse clicks"

From MiniScript Wiki
Jump to navigation Jump to search
Line 3: Line 3:
 
isDown = mouse.button
 
isDown = mouse.button
 
if isDown and not wasDown then
 
if isDown and not wasDown then
print "Sprite clicked!"
+
print "Mouse button clicked!"
 
end if
 
end if
 
wasDown = isDown
 
wasDown = isDown

Revision as of 09:39, 20 November 2021

wasDown = false
while true  // press Control-C to exit
	isDown = mouse.button
	if isDown and not wasDown then
		print "Mouse button clicked!"
	end if
	wasDown = isDown
	yield	
end while