Showing (complex) creator-defined-displayable as background

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
coneofshamedev
Newbie
Posts: 4
Joined: Sun Sep 09, 2018 12:44 pm
Github: coneofshamedev
Contact:

Showing (complex) creator-defined-displayable as background

#1 Post by coneofshamedev »

So I'm working on a game that features a Pokemon-style overworld grid. It takes both keyboard and mouse input to move a player avatar about the grid.

The overworld grid is programmed as a creator-defined-displayable.

My goal is for the overworld grid to serve as the background for any dialogue triggered on it, like when the player reads a sign for instance. I need player input to not affect the underlying overworld as well. So far I've been unable to to make this happen, either the background of the Say screen is a black screen, or the overworld grid completely covers the character sprite on the Say screen.

Here's the relevant snippets of my code right now:

in overworld_grid_screen_handler.rpy:

Code: Select all

label grid_handler_init:
    # SINGLETON OverworldGridHandler, which is a wrapped dict that
    # contains all the overworld grids that have been declared.
    $ OVERWORLD_GRID_HANDLER = OverworldGridHandler()
    $ arrow_player_character = get_arrow_player_character()
    return

screen overworld_screen(frozen=False):
    modal True
    tag overworld
    zorder -10

    $ config.skipping = None
    $ active_overworld_grid = OVERWORLD_GRID_HANDLER.active_grid

    if not frozen and (active_overworld_grid and active_overworld_grid.player_can_move):
        $ print("Overworld Grid Screen Handler: Freezing actions")
        key "mouseup_1" action NullAction()
        key "K_RETURN" action NullAction()
        key "K_SPACE" action NullAction()
        key "K_KP_ENTER" action NullAction()
        key "joy_dismiss" action NullAction()
        key "K_UP" action NullAction()
        key "K_RIGHT" action NullAction()
        key "K_DOWN" action NullAction()
        key "K_LEFT" action NullAction()

    $ renpy.timeout(0)
    add active_overworld_grid

label overworld_grid_screen_handler:
    $ print("overworld_grid_screen_handler called")
    while FORCE_EXIT != True:
        $ renpy.retain_after_load()
        call screen overworld_screen nopredict

    return

label overworld_grid_show_in_background:
    $ previous_player_can_move = OVERWORLD_GRID_HANDLER.active_grid.player_can_move
    $ OVERWORLD_GRID_HANDLER.active_grid.player_can_move = False
    show screen overworld_screen(frozen=True)
    return

label overworld_grid_stop_show_in_background:
    $ OVERWORLD_GRID_HANDLER.active_grid.player_can_move = previous_player_can_move
    return
in script.rpy:

Code: Select all

# The game starts here.
label start:
    call grid_handler_init
    call route_4_init
    $ OVERWORLD_GRID_HANDLER.active_grid_key = "route_4"
    $ FORCE_EXIT = False
    $ renpy.profile_screen("overworld_screen")
    call overworld_grid_screen_handler

    return
and finally the label that I'm calling that tries to call the Say screen on top of my overworld:

Code: Select all

label route_4_green_hates_grass_0:
    call overworld_grid_show_in_background

    show green angry with fade
    PLAYER_CHARACTER "Oh no, not more grass. No, I'm done."

    call overworld_grid_stop_show_in_background
    return
Currently, this shows just the PLAYER_CHARACTER sprite on a black background.
Any help would be greatly appreciated, I'm pretty new at this ren'py stuff!

GIF of output of current code: https://i.imgur.com/jkmo3TC.gif

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], GetOutOfMyLab, VESTED