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.
-
Overdose
- Newbie
- Posts: 23
- Joined: Sun May 27, 2018 12:30 am
#1
Post
by Overdose » 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! ^^;;

-
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:
#2
Post
by Per K Grok » Sun Jul 07, 2019 4:46 pm
Overdose 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! ^^;;
Maybe this thread can help you
viewtopic.php?t=28495
-
Overdose
- Newbie
- Posts: 23
- Joined: Sun May 27, 2018 12:30 am
#3
Post
by Overdose » Sun Jul 07, 2019 6:13 pm
Per K Grok wrote: ↑Sun Jul 07, 2019 4:46 pm
Overdose 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! ^^;;
Maybe this thread can help you
viewtopic.php?t=28495
Ah, I did find that thread, but couldn't understand where to put them... ^^;
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:
#4
Post
by Per K Grok » Mon Jul 08, 2019 4:11 am
Overdose wrote: ↑Sun Jul 07, 2019 6:13 pm
---------------
Ah, I did find that thread, but couldn't understand where to put them... ^^;
Can you explain please?
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.
-
Overdose
- Newbie
- Posts: 23
- Joined: Sun May 27, 2018 12:30 am
#5
Post
by Overdose » Mon Jul 08, 2019 4:55 am
Per K Grok wrote: ↑Mon Jul 08, 2019 4:11 am
Overdose wrote: ↑Sun Jul 07, 2019 6:13 pm
---------------
Ah, I did find that thread, but couldn't understand where to put them... ^^;
Can you explain please?
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.
Oh, it works!! Thank you ever so much!
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:
#6
Post
by Per K Grok » Mon Jul 08, 2019 6:31 am
Overdose wrote: ↑Mon Jul 08, 2019 4:55 am
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?
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.
Overdose wrote: ↑Mon Jul 08, 2019 4:55 am
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...
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))
-
Overdose
- Newbie
- Posts: 23
- Joined: Sun May 27, 2018 12:30 am
#7
Post
by Overdose » Mon Jul 08, 2019 7:47 am
Per K Grok wrote: ↑Mon Jul 08, 2019 6:31 am
Overdose wrote: ↑Mon Jul 08, 2019 4:55 am
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?
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.
Overdose wrote: ↑Mon Jul 08, 2019 4:55 am
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...
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))
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
- 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:
#8
Post
by Per K Grok » Mon Jul 08, 2019 3:12 pm
Overdose wrote: ↑Mon Jul 08, 2019 7:47 am
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 ^^;;
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.
Users browsing this forum: Bing [Bot], Majestic-12 [Bot]