So i'm trying to add tooltips for some stuff in my game. Basically, when you open the menu you can see the states of the character, positive or negative. So i want to add tooltips to those states.
First of all i know Olivia has already created a plugin about tooltips on states but a) it does this for the battle scene and b) it costs about $10. Now, if it did what i wanted it to, i would happily pay for it, but it doesn't, so i decided to look at the problem myself.
Now, realistically i could add a tooltip by setting a property in the <div> where the icon is located, and then setting up a script that property will be governed by. So i opened up the console while my game was open and i used jQuery to find the screen of the game, which, by the way, is found by $(#GameCanvas) for anyone interested (sorry if that was common knowledge, i only found this out just now). Anyway, i thought that, probably, the state icons could be in some <div> in there, so i could simply add a tooltip property and then control it via a function. What i found is that things aren't that simple.
I couldn't even add a property as .prop and .attr result in errors (there's no such function) and setProperty(name,value) from __proto__ doesn't seem to *add* but change properties' values. However, even if i could add a property, i have no idea where it should be since the states' icons aren't in there.
My thoughts were that, since i draw the icons, i know their x,y values, so i could, perhaps, create new properties with tooltips inside the div containing #GameCanvas, with those x, y values, and then check whether the mouse is hovering or not through scripts. This could work in theory, but i have no idea if it would *actually* work.
So my main question to you guys is whether i'm looking at it from the right direction, or whether i'm in the complete opposite one. My secondary questions (if the answer to the main one is 'yes'), are i) how do i add a property? ii) has anyone else thought about this and come to some conclusion, willing to share?
Obviously, doing this without having to change anything in the html is much much better, since i don't want to risk messing everything up. But if it's script alone, i have no idea how to do it.
Note that i'm still a newbie when it comes to js, so i might have made some mistakes in my train of thoughts up there.