Screen following the cursor in Main Menu
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.
Screen following the cursor in Main Menu
Hello! So, this is something I would like to do, but I have no idea how to do it...
I want to make the screen/image follow the cursor in the main menu. Like a parallax effect.
I also would like to make a sort of sparkling effect, going from the bottom of the screen and fading out at the top at random.
I would appreciate if someone could give me the code needed and where to put it... thank you! ^^;;
I want to make the screen/image follow the cursor in the main menu. Like a parallax effect.
I also would like to make a sort of sparkling effect, going from the bottom of the screen and fading out at the top at random.
I would appreciate if someone could give me the code needed and where to put it... thank you! ^^;;
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Screen following the cursor in Main Menu
Maybe this thread can help youOverdose wrote: ↑Sun Jul 07, 2019 3:42 pm Hello! So, this is something I would like to do, but I have no idea how to do it...
I want to make the screen/image follow the cursor in the main menu. Like a parallax effect.
I also would like to make a sort of sparkling effect, going from the bottom of the screen and fading out at the top at random.
I would appreciate if someone could give me the code needed and where to put it... thank you! ^^;;
viewtopic.php?t=28495
Re: Screen following the cursor in Main Menu
Ah, I did find that thread, but couldn't understand where to put them... ^^;Per K Grok wrote: ↑Sun Jul 07, 2019 4:46 pmMaybe this thread can help youOverdose wrote: ↑Sun Jul 07, 2019 3:42 pm Hello! So, this is something I would like to do, but I have no idea how to do it...
I want to make the screen/image follow the cursor in the main menu. Like a parallax effect.
I also would like to make a sort of sparkling effect, going from the bottom of the screen and fading out at the top at random.
I would appreciate if someone could give me the code needed and where to put it... thank you! ^^;;
viewtopic.php?t=28495
Can you explain please?
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Screen following the cursor in Main Menu
You can put the first part of the script at the top of your script.rpy
the second part 'add TrackCursor("target1.png")' you can put in screens.rpy under 'screen main_menu():' after the line
add gui.main_menu_background
Don't forget to change "target1.png" to whatever image your are using including the folder names if the image is in a sub-folder to games.
Re: Screen following the cursor in Main Menu
Oh, it works!! Thank you ever so much!Per K Grok wrote: ↑Mon Jul 08, 2019 4:11 amYou can put the first part of the script at the top of your script.rpy
the second part 'add TrackCursor("target1.png")' you can put in screens.rpy under 'screen main_menu():' after the line
add gui.main_menu_background
Don't forget to change "target1.png" to whatever image your are using including the folder names if the image is in a sub-folder to games.
I have a couple more questions ^^;
How do I make the image lag slightly behind? Like the cursor moves to the right, and the image takes a couple seconds longer to get to the position of the cursor?
And as the image I'm using is big, can I make it center to the screen? Using an image the same size as the game makes it so you can see outside the image if you move the cursor too far...
Thank you for your time!
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Screen following the cursor in Main Menu
Sorry. I have no ready solution to that. You could look at the python function time and time.sleep that is a way to pause a python program. Maybe you can do something with that.
The image is drawn centered to the mouse pointer, so you need an image with twice the width and height of the game screen to avoid that the edge of the image is showing.
If you only want the image to move in one direction, i.e. left-wright, you need to find this line in the code
rv.blit(cr, (self.x - cw /2, self.y - ch / 2))
and change it to
rv.blit(cr, (self.x - cw /2, 0))
Re: Screen following the cursor in Main Menu
Yes, the image is bigger than the game screen. But its showing the corner of the image and not the center is what I mean ^^;;Per K Grok wrote: ↑Mon Jul 08, 2019 6:31 amSorry. I have no ready solution to that. You could look at the python function time and time.sleep that is a way to pause a python program. Maybe you can do something with that.
The image is drawn centered to the mouse pointer, so you need an image with twice the width and height of the game screen to avoid that the edge of the image is showing.
If you only want the image to move in one direction, i.e. left-wright, you need to find this line in the code
rv.blit(cr, (self.x - cw /2, self.y - ch / 2))
and change it to
rv.blit(cr, (self.x - cw /2, 0))
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Screen following the cursor in Main Menu
The center of the image follows the pointer. When the pointer gets close to the edge of the screen, if the image is not twice the size of the screen, the edge of the image will show up.
You say your image is bigger than the game screen. But is it twice as big? I don't think it is. If it where you should not have this problem.
Re: Screen following the cursor in Main Menu
Okay, I did it! My apologies, I was using the code from this; viewtopic.php?f=8&t=53859&p=511237&hili ... ax#p511237
What I needed to do was change add the commented out lines ^^;;
Thank you for your time and help!
What I needed to do was change add the commented out lines ^^;;
Thank you for your time and help!
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]