[Solved, but open to advice] Moving the scene with an onscreen 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
solarProtag
Regular
Posts: 37
Joined: Sun May 28, 2017 12:17 am
Completed: http://solarprotag.weebly.com/gamedev.html
Projects: Battle Live Series
Tumblr: solarasketchbook
itch: solarprotagonist
Contact:

[Solved, but open to advice] Moving the scene with an onscreen button.

#1 Post by solarProtag »

Hi there!

I'm currently working on figuring out a point and click system for my game and everything is going well, except that I'm having trouble with showing the rest of the screen. What I want is for a button on my screen to slide the background a direction and then have more places to click on in the newly accessible side of the screen. (The best example I can give is the Ace Attorney games and how you can click a → or ← button to move the screen over).

If anyone can lend a hand I'd appreciate it, thanks!
Last edited by solarProtag on Thu Oct 24, 2019 1:12 pm, edited 1 time in total.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Moving the scene with an onscreen button.

#2 Post by Per K Grok »

solarProtag wrote: Wed Oct 23, 2019 5:49 pm Hi there!

I'm currently working on figuring out a point and click system for my game and everything is going well, except that I'm having trouble with showing the rest of the screen. What I want is for a button on my screen to slide the background a direction and then have more places to click on in the newly accessible side of the screen. (The best example I can give is the Ace Attorney games and how you can click a → or ← button to move the screen over).

If anyone can lend a hand I'd appreciate it, thanks!
You could do something like this,

With the button you jump to a label.
There you hide the screen you use to be able to click on stuff.
Move the background to the new position.
Show a screen with clickable areas for the new position.

There might be something useful to you in this cookbook thread
viewtopic.php?f=51&t=53333#p502719

User avatar
solarProtag
Regular
Posts: 37
Joined: Sun May 28, 2017 12:17 am
Completed: http://solarprotag.weebly.com/gamedev.html
Projects: Battle Live Series
Tumblr: solarasketchbook
itch: solarprotagonist
Contact:

Re: Moving the scene with an onscreen button.

#3 Post by solarProtag »

Huh, I suppose that's a way I could do it.

Hopefully one day the ability to add ATL statements to a button gets added to renpy, but until then I suppose I'll use the label method.
That thread also looks pretty promising, so I'll check it out, thanks!

philat
Eileen-Class Veteran
Posts: 1910
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: [Solved, but open to advice] Moving the scene with an onscreen button.

#4 Post by philat »

You can use ATL statements on a button/screens in general. Nonetheless, it's simpler to do the label thing if you don't want to go through the hassle of doing it purely in screens.

User avatar
solarProtag
Regular
Posts: 37
Joined: Sun May 28, 2017 12:17 am
Completed: http://solarprotag.weebly.com/gamedev.html
Projects: Battle Live Series
Tumblr: solarasketchbook
itch: solarprotagonist
Contact:

Re: [Solved, but open to advice] Moving the scene with an onscreen button.

#5 Post by solarProtag »

I actually tried to figure out how to use atl with a button but the regular button action statement doesn't accept that, only for showing a screen's transition and the like.

As an aside, laying out my labels like this:

Code: Select all

label A:
	show bg at left with move

	call screen pointnclick
	pause
with a label for each direction (left, middle, right) works since it takes the bg I have in that scene, I just need to figure out how to not need each of those labels for every point n click screen I have in my game (for calling the previous screen again).

philat
Eileen-Class Veteran
Posts: 1910
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: [Solved, but open to advice] Moving the scene with an onscreen button.

#6 Post by philat »

Dunno what you were doing, but all you have to do is show the relevant screen.

Code: Select all

screen testatl(xpos=0.5):
    hbox:
        textbutton "<" action Show("testatl", xpos=0.25)
        textbutton ">" action Show("testatl", xpos=0.75)

    add Solid("#FFF", xysize=(50,50)) at atl(xpos)

transform atl(xpos):
    linear 0.5 xpos xpos
    
label start:
    show screen testatl
    pause

Post Reply

Who is online

Users browsing this forum: Bing [Bot], juliaa__