Limiting animations to a specific spot

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
BrumaDev
Newbie
Posts: 11
Joined: Wed Apr 28, 2021 9:08 pm
Projects: Occult:Rewrite
itch: brumadev
Location: Brazil
Contact:

Limiting animations to a specific spot

#1 Post by BrumaDev »

Hello! This might sound easy, but somehow I haven't fond a way to work this out:

Is there a way to limit a scrolling animation to a specific spot using ATL?
For example, my game has a screen that looks like this:

Image

and I'd like to make a fog effect that looks somewhat like this example I found elsewhere

Image

However, here, I'd like to make it so there's a fog animation that loops around only in the screen displayable area, which is easy to do if your background spans the whole screen, but here, the background is limited.

Is this possible? If there's no way around it, I could animate it by hand in the background itself, but it'll look really choppy compared to using ATL's linear command, which is the reason I'm avoiding it.
Do you like VNs with more gameplay?
Are you interested in the paranormal?
Check out my new project Occult:Rewrite
Image

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

Re: Limiting animations to a specific spot

#2 Post by philat »

Immediate thought is to either crop or use AlphaMask to limit the visibility of the animated background to the viewport, but not knowing the specifics of how it's set up, hard to give concrete examples.

BrumaDev
Newbie
Posts: 11
Joined: Wed Apr 28, 2021 9:08 pm
Projects: Occult:Rewrite
itch: brumadev
Location: Brazil
Contact:

Re: Limiting animations to a specific spot

#3 Post by BrumaDev »

philat wrote: Thu Apr 29, 2021 3:19 am Immediate thought is to either crop or use AlphaMask to limit the visibility of the animated background to the viewport, but not knowing the specifics of how it's set up, hard to give concrete examples.
I see. Alphamask sounds promissing, but I'm not 100% sure of how it works. The only time I messed around with it was on the imagebutton tutorial, and the use there was a bit different. That said, an explanation of how that mechanic works would be greatly appreciated. That might be the way to go. The one written in the official documentation is a little difficult for me to follow.

As far as how the whole display is being setup, here's how it goes: Every item of the screen is an individual image using a simple image definition (except for the dialoguebox, which I believe is defined as a "screen"). The box that reads "evidence" for example is setup as

Code: Select all

# in screens script
image evidence:
    "gui/UI/evidencebox.png"
    xpos 0.132
    ypos 0.49

# in the main script
show evidence
And so on. The important part, the "background", is setup the same way. It has an image at a lower zorder to make that little border, with the boat illustration aligned on top. It's actually an animation too, this is how it looks in the code

Code: Select all

image boatanimated:
    "images/backgrounds/a/boat1.png" with Dissolve(0.5)
    xalign 0.840
    yalign 0.272
    pause 0.5
    "images/backgrounds/a/boat2.png" with Dissolve(0.5)
    xalign 0.840
    yalign 0.272
    pause 0.5
    "images/backgrounds/a/boat3.png" with Dissolve(0.5)
    xalign 0.840
    yalign 0.272
    pause 0.5
    "images/backgrounds/a/boat4.png" with Dissolve(0.5)
    xalign 0.840
    yalign 0.272
    pause 0.5
    repeat
In theory, I thought about tying it to the "boatanimated" image somehow, but I don't really know how to do it :(
Do you like VNs with more gameplay?
Are you interested in the paranormal?
Check out my new project Occult:Rewrite
Image

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

Re: Limiting animations to a specific spot

#4 Post by philat »

There are several threads on AlphaMask and AlphaBlend if you poke around the forums. From a quick glance, this looks similar to what you need: viewtopic.php?t=34323

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], VESTED