Hi,
I have a bookcase where I want to display a 'different' (random from a short list) label for each book. Rather than drawing out multiple hotspots / gui labels etc, is there a way to generate a 'grid' over the graphics and then show a different piece of text when the mouse moves from one cell/book to another?
(http://tom-simpson.com/Library_BookCase1.png)
Thanks!
How about using mouse x/y coordinates in some way? Would that work?
Quote from: ManicMatt on Mon 18/02/2019 08:22:10
How about using mouse x/y coordinates in some way? Would that work?
Yes, I had thought of a way that would involve a lot of if / else statements to check the mouse co-ordinate, but I'm sure there's a better way.
im not sure if the books are too close together but what about importing an object that is just the books with pixel spaces in between and then you set it to randomise what the description is. Although if they went back to the previous book it would be different again..
i think i might be on to something though.
Grab the x and y of the mouse and subtract the top left corner.
Now divide both coordinates by a book's width / shelve height to get Book/Shelve coordinates.
Finally, multiply y by the number of books per shelve, then add x to get a unique index i for every book.
No if/else required.
Quote from: Khris on Mon 18/02/2019 08:54:37
Grab the x and y of the mouse and subtract the top left corner.
Now divide both coordinates by a book's width / shelve height to get Book/Shelve coordinates.
Finally, multiply y by the number of books per shelve, then add x to get a unique index i for every book.
No if/else required.
Thanks Khris, got it!