Need to clear message? (SOLVED)

When this bit of code is triggered, the message gets sent several times. Does it need to be cleared somehow? Mouse left click is mapped to action “thump”.

Also, is there some equivalent to pointer_over() for sprites etc or is manual checking as below the only way?

function on_input(self, action_id, action)
-- if clicked over ringo, send ringo a message
if action_id == hash("thump") then
	local rpos = go.get_position("ringo")
	if math.abs(rpos.x - action.x) < 20 and math.abs(rpos.y - action.y) < 20 then
		msg.post("ringo#ringoprog", "biff")
	end
end	

end

“mouse-button-left” actually don’t means “click”, it’s source of the input.


it can be pressed, released and repeated, so:

if action_id == hash("thump") and action.released then
2 Likes

Oops, thanks for clearing that up :smiley: