so basically i need a image within a main_menu screen
that will update it's location according to my mouse pointer location.
lets assume it should stick to mouse pointer without being a mouse pointer,
or it should act as mirror projection of the cursor.
If i get these examples i will be able to adapt it for my needs.
For now i cannot figure out how to add an image with variable location
and how to repeatedly update this image.
What i can is locate my cursor coordinates
and make desirable image using an SpriteManager() example from docs but i cannot figure out how to add this to a screen.
Many thanks if you can help! Thanks anyway for bothering n__n
image tracking the cursor in main_menu screen[solved]
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.
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.
image tracking the cursor in main_menu screen[solved]
Last edited by SONTSE on Sun Sep 21, 2014 2:55 pm, edited 1 time in total.
Look! It's moving. It's alive. It's alive... IT'S ALIVE! Oh, in the name of God! Now I know what it feels like to be God!(@Henry_Frankenstein. Sums up my coding style)
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: image tracking the cursor in main_menu screen
CDD time! When you can't figure out how to do something, use a CDD.
Then add it to the screen with:
If people have questions, just ask - I want to get more CDD info out there.
Code: Select all
init python:
class TrackCursor(renpy.Displayable):
def __init__(self, child):
super(TrackCursor, self).__init__()
self.child = renpy.displayable(child)
self.x = None
self.y = None
def render(self, width, height, st, at):
rv = renpy.Render(width, height)
if self.x is not None:
cr = renpy.render(self.child, width, height, st, at)
cw, ch = cr.get_size()
rv.blit(cr, (self.x - cw / 2, self.y - ch / 2))
return rv
def event(self, ev, x, y, st):
if (x != self.x) or (y != self.y):
self.x = x
self.y = y
renpy.redraw(self, 0)
Code: Select all
add TrackCursor("target1.png")
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
Re: image tracking the cursor in main_menu screen[solved]
... and needless to say it works like a charm XD
Thank you, PyTom! You as brilliant as ever!
i think I'll need to dig on some RenPy/python manuals so i can understand what exactly does this code... after i overcome a shock seeing it ^^'''' well. anyway i already found how to tweak it for my needs, so its okay for now.
Thanks again!
Thank you, PyTom! You as brilliant as ever!
i think I'll need to dig on some RenPy/python manuals so i can understand what exactly does this code... after i overcome a shock seeing it ^^'''' well. anyway i already found how to tweak it for my needs, so its okay for now.
Thanks again!
Look! It's moving. It's alive. It's alive... IT'S ALIVE! Oh, in the name of God! Now I know what it feels like to be God!(@Henry_Frankenstein. Sums up my coding style)
Who is online
Users browsing this forum: Google [Bot], zyric