How would i make an image shake when hovered in a screen?

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
Artemaniac
Newbie
Posts: 2
Joined: Wed Dec 05, 2018 9:19 pm
Contact:

How would i make an image shake when hovered in a screen?

#1 Post by Artemaniac »

I have an image displayed on my main menu screen. How would i go about making the image shake when the mouse hovers over it? (two times) I am trying to make the shake similar to the HIVESWAP FRIENDSIM menu logo shake, because it was made in Ren'py as well. Can anyone please help? Thank you in advance.

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: How would i make an image shake when hovered in a screen?

#2 Post by DannX »

Use 'on hover' statement with ATL.
I haven't seen exactly how it is in the game you mention, but this is an example:

Code: Select all

transform shake_twice:
    on hover:
        linear .02 xoffset 10 
        linear .02 xoffset 0
        linear .02 xoffset -10 
        linear .02 xoffset 0
        repeat 2
Then in your screen:

Code: Select all

   add 'shaking_image' at shake_twice

Artemaniac
Newbie
Posts: 2
Joined: Wed Dec 05, 2018 9:19 pm
Contact:

Re: How would i make an image shake when hovered in a screen?

#3 Post by Artemaniac »

DannX wrote: Thu Dec 06, 2018 1:34 pm Use 'on hover' statement with ATL.
I haven't seen exactly how it is in the game you mention, but this is an example:

Code: Select all

transform shake_twice:
    on hover:
        linear .02 xoffset 10 
        linear .02 xoffset 0
        linear .02 xoffset -10 
        linear .02 xoffset 0
        repeat 2
Then in your screen:

Code: Select all

   add 'shaking_image' at shake_twice
thank you so much!!!! i have been testing stuff for so long thank youuu

Post Reply

Who is online

Users browsing this forum: Google [Bot]