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

From MiniScript Wiki
Jump to navigation Jump to search
 
Line 1: Line 1:
WIP
+
<ms>wasDown = false
 +
while true  // press Control-C to exit
 +
isDown = mouse.button
 +
if isDown and not wasDown then
 +
print "Sprite clicked!"
 +
end if
 +
wasDown = isDown
 +
yield
 +
end while</ms>
  
 
[[Category:How To]]
 
[[Category:How To]]
 
[[Category:Mini Micro]]
 
[[Category:Mini Micro]]
 
[[Category:Soda]]
 
[[Category:Soda]]

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 "Sprite clicked!"
	end if
	wasDown = isDown
	yield	
end while