Shake Screen/Sprite

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
User avatar
neometalero
Regular
Posts: 196
Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:

Shake Screen/Sprite

#1 Post by neometalero »

How can I shake the screen or the image sprite? I want the character to shake when there is dammage or an angry reaction for example.
Working on many weird narrative games at Curse Box Studios
Image
https://www.curseboxstudios.com/

User avatar
Donmai
Eileen-Class Veteran
Posts: 1958
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Shake Screen/Sprite

#2 Post by Donmai »

Choose a method: To shake the whole scene (including sprites, not sprites only) you can use the vpunch or hpunch transitions.
https://www.renpy.org/doc/html/transiti ... var-vpunch
https://www.renpy.org/doc/html/transiti ... var-hpunch
Or you can use this old cookbook recipe from the wiki (don't be afraid, it's old but it still works):
https://www.renpy.org/wiki/renpy/doc/co ... ake_effect
Alternatively, you can use an ATL transform. Personally, I think the python shake effect is still the best option.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
neometalero
Regular
Posts: 196
Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:

Re: Shake Screen/Sprite

#3 Post by neometalero »

There is any way to only shake the sprite? not the hole scene?
Working on many weird narrative games at Curse Box Studios
Image
https://www.curseboxstudios.com/

User avatar
Donmai
Eileen-Class Veteran
Posts: 1958
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Shake Screen/Sprite

#4 Post by Donmai »

Look at the example script in the shake effect page.

Code: Select all

# shaking the sprite by placing it at the center (where it already was)
ph "Ng!..."
show phoenix at center, Shake(None, 1.0, dist=5)
with None
When you use the effect in a sprite you only have to add its position (left, center or right). If you don't the shaking sprite will appear at left position.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
Taleweaver
Writing Maniac
Posts: 3428
Joined: Tue Nov 11, 2003 8:51 am
Completed: Metropolitan Blues, The Loyal Kinsman, Daemonophilia, The Dreaming, The Thirteenth Year, Adrift, Bionic Heart 2, Secrets of the Wolf, The Photographer
Projects: The Pilgrim's Path, Elspeth's Garden, Secret Adventure Game!
Organization: Tall Tales Productions
Location: Germany
Contact:

Re: Shake Screen/Sprite

#5 Post by Taleweaver »

Moved to Ren'Py Questions.
Scriptwriter and producer of Metropolitan Blues
Creator of The Loyal Kinsman
Scriptwriter and director of Daemonophilia
Scriptwriter and director of The Dreaming
Scriptwriter of Zenith Chronicles
Scriptwriter and director of The Thirteenth Year
Scriptwriter and director of Romance is Dead
Scriptwriter and producer of Adrift
More about me in my blog
"Adrift - Like Ever17, but without the Deus Ex Machina" - HigurashiKira

User avatar
neometalero
Regular
Posts: 196
Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:

Re: Shake Screen/Sprite

#6 Post by neometalero »

Donmai wrote: Fri Dec 22, 2017 11:09 pm Look at the example script in the shake effect page.

Code: Select all

# shaking the sprite by placing it at the center (where it already was)
ph "Ng!..."
show phoenix at center, Shake(None, 1.0, dist=5)
with None
When you use the effect in a sprite you only have to add its position (left, center or right). If you don't the shaking sprite will appear at left position.
Tks a lot , I will try that
Working on many weird narrative games at Curse Box Studios
Image
https://www.curseboxstudios.com/

User avatar
neometalero
Regular
Posts: 196
Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:

Re: Shake Screen/Sprite

#7 Post by neometalero »

Ok that was actually really easy to do, tks for the help. When I first found that example It looked really complicated but it was actually quite simple to use.
Working on many weird narrative games at Curse Box Studios
Image
https://www.curseboxstudios.com/

Post Reply

Who is online

Users browsing this forum: Bing [Bot]