This page is out of date

You've reached a page on the Ren'Py wiki. Due to massive spam, the wiki hasn't been updated in over 5 years, and much of the information here is very out of date. We've kept it because some of it is of historic interest, but all the information relevant to modern versions of Ren'Py has been moved elsewhere.

Some places to look are:

Please do not create new links to this page.


Double Vision Effect - (9/17/11)

The following code produces a blurred "double vision" effect. This was used in the games Gakuen Redux and Secretary of Death.

The basic idea is that you create a half-opaque version of the background, and then show it at a random location after showing the background. That doesn't mean that invoking this effect during your story requires two statements, just one.

init:

    image cs2 = Image("b_city_scape_02.gif")

    transform transpa:

        alpha 0.5

    python hide:

        def gen_randmotion(count, dist, delay):

            import random

            args = [ ]

            for i in range(0, count):
                args.append(anim.State(i, None,
                                       Position(xpos=random.randrange(-dist, dist),
                                                ypos=random.randrange(-dist, dist),
                                                xanchor='left',
                                                yanchor='top',
                                                )))

            for i in range(0, count):
                for j in range(0, count):

                    if i == j:
                        continue

                    args.append(anim.Edge(i, delay, j, MoveTransition(delay)))

            return anim.SMAnimation(0, *args)

        store.randmotion = gen_randmotion(5, 5, 1.0)


init python:

    def double_vision_on(picture):

        renpy.scene()

        renpy.show(picture)

        renpy.show(picture, at_list=[transpa,randmotion], tag="blur_image")

        renpy.with_statement(dissolve)


    def double_vision_off():

        renpy.hide("blur_image")

        renpy.with_statement(dissolve)


label start:

    $ double_vision_on("cs2")

    "Presented in DOUBLE-VISION (where drunk)."

    $ double_vision_off()

    "Oh. Now I'm fine"

In this code, this statement which actually produce the effect during the story is:

    $ double_vision_on("cs2")

However, this interrupts the effect. It's the equivalent to for the image "blur_image":

    $ double_vision_off()

    hide blur_image

As you may have noticed, these Python's functions use equivalents to statements of Ren'Py language on Python. For more information about Python and Ren'Py-Statement Equivalents, Ren'Py Documentation:

init python:

    def double_vision_on(picture):

        # renpy.scene() and renpy.show() are like "scene". Alone, renpy.show() is like "show".

        renpy.scene()

        renpy.show(picture)

        # at_list is the same as "at" and tag= like "as".

        # It isn't suitable define a image with the same tag that this function

        renpy.show(picture, at_list=[transpa,randmotion], tag="blur_image")

        # renpy.with_statement() is like "with".

        # I added this because do the effect "soft" at the begining (and the end).

        renpy.with_statement(dissolve)


    def double_vision_off():

        # renpy.hide() is like "hide"

        renpy.hide("blur_image")

        renpy.with_statement(dissolve)