Page 1 of 1

[Solved]The text doesn't react to te mouse when it's over it

Posted: Wed Nov 18, 2015 6:27 pm
by Aik
So I was following a tutorial where with some function a text on the menu screen changes its color if you move your mouse over it, I was copying the code but when I run the project it just didn't work, and I can't found whats wrong with the code, even looking in others tutorials.
Here is the .love file.
test.love
(2.13 KiB) Downloaded 63 times

Re: The text doesn't react to te mouse when it's over it

Posted: Wed Nov 18, 2015 6:44 pm
by HugoBDesigner
You've got a typo on line 15 of menu.lua. It's 'mouseover', not 'mousever'

Also, to make it properly work, you'll need to add 'v.mouseover = false' on the first line of the for block, on line 40, like so:

Code: Select all

	for i,v in ipairs (button) do
		v.mouseover = false
		if mouse_x > v.x and
		mouse_x < v.x + medium:getWidth(v.text) and
		mouse_y > v.y and
		mouse_y < v.y + medium:getHeight() then
		 v.mouseover = true
		end
	end

Re: The text doesn't react to te mouse when it's over it

Posted: Wed Nov 18, 2015 7:58 pm
by Aik
Thank you! now it works perfectly.