mouse coordinates

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
shahab96
Veteran
Posts: 228
Joined: Mon May 24, 2010 5:40 am
Location: Lahore, Pakistan
Contact:

mouse coordinates

#1 Post by shahab96 »

I need a way to get the coordinates of the mouse to use them in tooltips, the thing is the tooltip is going to follow the mouse so I will also need something to constantly update the coordinates given to my tooltips. So can anyone help me out?
The true measure of a man is what he does with his power.

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: mouse coordinates

#2 Post by Aleema »

As far as I know, that can't be done in Ren'Py. There isn't anything that stores the coordinates of the mouse, since you can play the game on most any controller. The tooltips must be in a static place. Maybe you can try changing the mouse graphic? Haha, that probably can't change after the game runs, too, though. Sorry.

IceD
Veteran
Posts: 433
Joined: Sun Feb 01, 2009 6:15 pm
Contact:

Re: mouse coordinates

#3 Post by IceD »

IMO, tooltips following the mouse can be preety annoying. It's better to force them to be shown in one, pre-deterimned place and that can be done in many ways. If you have an object (a graphic or sprite) you can just write a code which will assign such a tooltip as a graphical sprite or even program them from scratch with python. Then, such tooltip will appear when you hoover your mouse pointer over such an object.

BTW. Could you be more specific and say what will be their purpose, as well where are they going to be used (ingame/menus/rpg battle sequences etc.)? We might help but we will need more info on what will/has to be done with them :)

shahab96
Veteran
Posts: 228
Joined: Mon May 24, 2010 5:40 am
Location: Lahore, Pakistan
Contact:

Re: mouse coordinates

#4 Post by shahab96 »

well, they are'nt really important. theres a map, and the tooltip is just a small picture of what the room your mouse is hovered over is, and what it looks like from the inside. however if it cant be done then thats fine as well.
The true measure of a man is what he does with his power.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: mouse coordinates

#5 Post by Alex »

Have you tried to define tooltips for every room with a specific coordinates?
Like

Code: Select all

$ tt1 = Tooltip(10, 380, "Tooltip 1")
$ tt2 = Tooltip(40, 180, "Tooltip 2")

$ ui.textbutton("Button 1", clicked=do_somthing, hovered=tt1.show, unhovered=tt1.hide)
$ ui.textbutton("Button 2", clicked=do_somthing, hovered=tt2.show, unhovered=tt2.hide)

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]