How to rotate an image on the main screen? [Solved]

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
Dawn
Newbie
Posts: 14
Joined: Sun Apr 30, 2017 3:49 am
Projects: Nephilim — Revelation
Contact:

How to rotate an image on the main screen? [Solved]

#1 Post by Dawn »

With "Tutorial", I'm able to do a rotation with an image using ATL Transformation:

Code: Select all

image magic = "magic.png"

show magic:
        yalign .5 subpixel True

        rotate 0
        linear 5 rotate 360
        repeat
I’d like to do this rotation on the main menu of my game. But it seems that I cannot use ATL. Only these transformation are available. Linear is unavailable and

Code: Select all

screen main_menu():

    ## This ensures that any other menu screen is replaced.
    tag menu

    style_prefix "main_menu"

    add gui.main_menu_background

    ## This empty frame darkens the main menu.
    frame:        
        pass
        
        transform:
            pos (220, 635)
            alpha 0.5            
            
            ## When I add linear there is an error
            #linear 4 rotate 360 

            ## When I add an AnimatedValue, it fails too
            #rotate AnimatedValue(0, 360, 1)

            ## When I add Animated there is another error
            image "tools/magic.png"
                
But I had a lot of errors. When I add linear, the error is:
File "game/screens.rpy", line 472: u'linear' is not a keyword argument or valid child for the transform statement.
When I used AnimatedValue, I have an error because rotate is waiting a float, not an AnimatedValue:
TypeError: unsupported operand type(s) for*: 'AnimatedValue' and 'float'.
I would like that the magic image turn on itself on the center of the main menu. Is there someone who can help me?
Last edited by Dawn on Sat Jun 17, 2017 7:17 am, edited 1 time in total.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: How to rotate an image on the main screen?

#2 Post by Divona »

See Animation and Transformation Language.

Code: Select all

transform rotate_object:
    rotate 0
    linear 4 rotate 360
    repeat

screen main_menu():

    ## This ensures that any other menu screen is replaced.
    tag menu

    style_prefix "main_menu"

    add gui.main_menu_background

    ## This empty frame darkens the main menu.
    frame:        
        pass

    add "tools/magic.png" at rotate_object:
        xalign 0.5
        yalign 0.5
        alpha 0.5
Completed:
Image

User avatar
Dawn
Newbie
Posts: 14
Joined: Sun Apr 30, 2017 3:49 am
Projects: Nephilim — Revelation
Contact:

Re: How to rotate an image on the main screen?

#3 Post by Dawn »

Thanks a lot! You saved me a lot of time. Before asking, I read ATL chapter, but I didn't understand this "add" statement. Thanks for your example. It works fine on my game.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]