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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Aik
Prole
Posts: 2
Joined: Wed Nov 18, 2015 6:05 pm

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

Post 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
Last edited by Aik on Wed Nov 18, 2015 7:59 pm, edited 1 time in total.
User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Above the Pocket Dimension
Contact:

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

Post 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
@HugoBDesigner - Twitter
HugoBDesigner - Blog
Aik
Prole
Posts: 2
Joined: Wed Nov 18, 2015 6:05 pm

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

Post by Aik »

Thank you! now it works perfectly.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 7 guests