CDD screen rotation and other animation

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
Unin
Regular
Posts: 54
Joined: Wed Sep 01, 2010 8:08 pm
Location: Florida
Contact:

CDD screen rotation and other animation

#1 Post by Unin »

I was hoping I could get away with using ATL on a Creator Defined Displayable, but I'm getting "preceding show screen statement statement does not expect a block". I'm getting the sinking feeling I'm going to have to define my own transformation functions. Is this the case?

Code: Select all

image bg_cockpit = "bg_cockpit.png"

define i = Character('Instructor', color="#64F0F0")

init python:

    class myDisplay(renpy.Displayable):
        def __init__(self, **kwargs):
            renpy.Displayable.__init__(self, **kwargs)

        def render(self, width, height, st, at):
            render = renpy.Render(400, 400)
            canvas = render.canvas()
           
            canvas.line("64F0F0", (339, 0), (339, 366), 3)
            canvas.line("64F0F0", (1, 0), (1, 366), 3)

            return render

screen hud:
    add myDisplay():
        xalign 0.5
        yalign 0.5

# The game starts here.
label start:
    show bg_cockpit:
        zoom 1.0 xalign 0.5 yalign 0.5
    i "Ok, lets ease to the left"
    show bg_cockpit:
        ease 3.0 rotate 25 xalign 0.4 yalign 0.2 zoom 1.5
    show screen hud:
        ease 3.0 rotate 20
    
    i "Good, now lets level off a bit..."

    return

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game\script.rpy", line 34: Line is indented, but the preceding show screen statement statement does not expect a block. Please check this line's indentation.
    ease 3.0 rotate 20
    ^

Ren'Py Version: Ren'Py 6.14.1.366
I'm using canvas instead of simply a transparent png because I'm hoping for noticeable aliasing, like in retro flight sims.

Kinsman
Regular
Posts: 130
Joined: Sun Jul 26, 2009 7:07 pm
Location: Fredericton, NB, Canada
Contact:

Re: CDD screen rotation and other animation

#2 Post by Kinsman »

Let myDisplay() be an ordinary image, and use the show statement. If you want to make sure it acts like a HUD that overlays everything else, use the 'onlayer' keyword.

Code: Select all

show expression myDisplay() as hud onlayer "screens":
    xalign 0.5 yalign 0.5
    ease 3.0 rotate 20
Flash To Ren'Py Exporter
See the Cookbook thread

Unin
Regular
Posts: 54
Joined: Wed Sep 01, 2010 8:08 pm
Location: Florida
Contact:

Re: CDD screen rotation and other animation

#3 Post by Unin »

sweet! works great. Adding a pitch ladder now, which needs to shift vertically while cropping to give the illusion of scrolling in place. wonder what happens if I try and crop CDDs. will it work just like a normal image? do the x and y of the crop tuple apply to the main screen as a whole, or the render's own space?

Post Reply

Who is online

Users browsing this forum: Bing [Bot]