Changing game width/height with in game button?

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
Geckos
Veteran
Posts: 471
Joined: Fri Aug 17, 2012 8:33 am
Completed: Brilliant Shadows, Perceptions of the Dead, The Phantom Icecream Truck
Projects: Embers of Magic, Pale Spectrum, Perceptions of the Dead
Organization: Ithaqua Labs
Tumblr: geckosart
Deviantart: sitaart
Contact:

Changing game width/height with in game button?

#1 Post by Geckos » Mon Oct 26, 2015 12:51 pm

I am considering trying to combine two short visual novels into one game with title headings: Chapter 1, Chapter 2.
The idea is that Chapter 1 leads you to a game that is 800 x 600 resolution, and that Chapter 2 leads you to a game that is 768 x 1366.

I tried an if statement but the game didn't like that. Is this at all plausible or should I stop trying?
Image ImageImage

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Changing game width/height with in game button?

#2 Post by PyTom » Tue Oct 27, 2015 1:33 am

I'll be honest, it would be kind of hard - Ren'Py isn't designed for this.

Probably the way to do this would be to have something like (requires 6.99.7):

Code: Select all


define persistent.part = 1

init python:
   if persistent.part == 1:
       config.screen_width = 800
       config.screen_height = 600
   else:
       config.screen_width = 768
       config.screen_height = 1366

   class ChangePart(Action):
        def __init__(self, part):
            self.part = part
        def __call__(self):
            persistent.part = self.part
            renpy.utter_restart()

label start:
    if persistent.part == 1:
        jump part1
    else:
        jump part2

[code]

And then add something like:

[code]
textbutton "Part 1" action ChangePart(1)
textbutton "Part 2" action ChangePart(2)

Another option might be to use some clever styles for the text box, and a layer transform to rescale the master layer.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Bing [Bot]