Add simple image to screen

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
RyuMaster
Newbie
Posts: 10
Joined: Mon Apr 08, 2013 6:53 am
Contact:

Add simple image to screen

#1 Post by RyuMaster » Mon Apr 08, 2013 6:59 am

Hi! For the last 2 hours, I can't do this simple stuff, searching and googling and trying... , so I decided to ask for help.

I've changed main menu background. Then I decided to add simple animation on top of it, playing from file frames. I see there are many ways, but I decided to go via altering main menu screen. So, inside scree.rpy:

Code: Select all

screen main_menu:

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

    # The background of the main menu.
    window:
        style "mm_root"
        add "main_menu" <--- I ADDED THIS 
i added new main_menu image.

Before this, inside my script.rpy, I have added this:

Code: Select all

image main_menu:
        "menuwalk/menuwalk_0135.png"
        xanchor 0.5
        yanchor 0.5
        rotate 0
        linear 50.0 rotate 360
        repeat
Code compiles fine, but I do not see new image. And I just can't debug why. Maybe wrong path? But when I changed path, or even renamed main_menu to main_menu2, I did not get any error 0_0

So, umm, my first question: after all I did, why I still can't see my animation playing on main menu?

Second: Can I somehow force renpy to throw errors, when it encounters undefiend variable or path which doesn't exist?

madmarten
Newbie
Posts: 22
Joined: Wed Sep 12, 2012 9:29 pm
Contact:

Re: Add simple image to screen

#2 Post by madmarten » Mon Apr 08, 2013 12:12 pm

I tried the code and it works fine for me. It places it in the top left corner, so it might be hard to see. Add xalign 0.5 and yalign 0.5 to center it.

RyuMaster
Newbie
Posts: 10
Joined: Mon Apr 08, 2013 6:53 am
Contact:

Re: Add simple image to screen

#3 Post by RyuMaster » Mon Apr 08, 2013 6:42 pm

Thank you very much, now that I'm positive that it works, I'll try to understand why I can't see it. At least now I know that code itself is working properly.

RyuMaster
Newbie
Posts: 10
Joined: Mon Apr 08, 2013 6:53 am
Contact:

Re: Add simple image to screen

#4 Post by RyuMaster » Mon Apr 08, 2013 10:56 pm

FINALLY! MUCH YESSNESS!

##layout.grouped_main_menu()
##config.main_menu_per_group = 2

I had to comment this to make changes visible. So, if I use grouped layout, where should I add new image istead of directly adding it into screens script main_menu?

Post Reply

Who is online

Users browsing this forum: Bing [Bot]