How to Update Outdated Shake Effect

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
LuckyJack020
Newbie
Posts: 1
Joined: Sat Jul 10, 2021 3:55 pm
Contact:

How to Update Outdated Shake Effect

#1 Post by LuckyJack020 »

My game used to use the Shake Effect in the outdated Ren'Py cookbook (found here https://www.renpy.org/wiki/renpy/doc/co ... ake_effect ) and with the new updates with the new Position type variable, is it at all possible to receive some help with updating this Effect's code to where I would not need to include the "define config.mixed_position = False" line typically required for fixing this?

It seems to be tied to trying to use xpos and ypos (now the new Position variable) in a math calculation when it's expecting an integer for this portion of the code

nx = xpos + (1.0-t) * self.dist * (renpy.random.random()*2-1)
ny = ypos + (1.0-t) * self.dist * (renpy.random.random()*2-1)

User avatar
Andredron
Miko-Class Veteran
Posts: 720
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: How to Update Outdated Shake Effect

#2 Post by Andredron »

Code: Select all

transform shake2(rate=0.090):
        linear rate xoffset 2 yoffset 0
        linear rate xoffset -2.8 yoffset 2
        linear rate xoffset 2.8 yoffset 0
        linear rate xoffset -2 yoffset 2
        linear rate xoffset +0 yoffset +0
        repeat

transform shake3(rate=0.090):
        linear rate xoffset 2
        linear rate xoffset -2.8
        linear rate xoffset 2.8
        linear rate xoffset -2
        linear rate xoffset +0
        repeat
https://renpymemo.hateblo.jp/entry/2022/02/06/000000

Post Reply

Who is online

Users browsing this forum: Google [Bot]