ATL infinite bg scroll

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
heise
Newbie
Posts: 2
Joined: Mon Jan 16, 2017 8:00 pm
Contact:

ATL infinite bg scroll

#1 Post by heise »

I'm trying to get a background to scroll infinitely across the screen, but I haven't been able to get the effect to work.

A video of what I have so far that hopefully shows what effect I'm going for: http://sendvid.com/kpfmq8nb

And the code I have so far:

Code: Select all

image bg_bus_interior_window_welcome_to_cascadia_ani:
   contains:
      parallel:
        #queue image in the back and wait for the end of the second copy to scroll on-screen
         HBox("images/bg/parts/cascadia_outskirts_bg.png","images/bg/parts/cascadia_outskirts_bg.png")
         xoffset 0
         pause 5.05
         linear 8.5 xoffset 1980
         xalign 1
         yalign 1
         repeat

   contains:
      parallel:
         HBox("images/bg/parts/cascadia_outskirts_bg.png","images/bg/parts/cascadia_outskirts_bg.png")
         xoffset 0
         linear 8.5 xoffset 1980
         xalign 1
         yalign 1
         repeat

   contains:
      subpixel True
      "images/bg/bus_interior.png"
      xalign 0.5
      yalign 0.5

      parallel:
         #Bus sway
         #Hori sway
         linear 2.25 xoffset 13
         linear 2.25 xoffset -13
         #Hori sway
         linear 2.25 xoffset 13
         #Double jump
         linear 0.032 yoffset -1
         pause 0.041
         linear 0.035 yoffset 1
         pause 0.3
         linear 0.033 yoffset -1
         pause 0.15
         linear 0.03 yoffset 1
         pause 0.05
         #Hori sway
         linear 2.25 xoffset -13
         #Hori sway
         linear 2 xoffset 13
         linear 2 xoffset -13
         #Jump
         linear 0.026 yoffset -2
         pause 0.032
         linear 0.022 yoffset 2
         repeat
Hopefully someone better at animations can give me a hand, I haven't been able to turn up anything helpful on Google.

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: ATL infinite bg scroll

#2 Post by nyaatrap »

You don't need to position same image two times. Instead, you can use xpan. https://www.renpy.org/doc/html/atl.html ... perty-xpan

Code: Select all

    show bg:
        xpan -180
        linear 10.0 xpan 180
        repeat

heise
Newbie
Posts: 2
Joined: Mon Jan 16, 2017 8:00 pm
Contact:

Re: ATL infinite bg scroll

#3 Post by heise »

Thank-you! I knew there had to be a better way then the hacky way I was trying.

Code: Select all

image bg_bus_interior_window_welcome_to_cascadia_ani:
   contains:
      parallel:
         "images/bg/parts/cascadia_outskirts_bg.png"
         xpan 180
         linear 7 xpan -180
         xalign 1
         yalign 1
         repeat

   contains:
      subpixel True
      "images/bg/bus_interior.png"
      xalign 0.5
      yalign 0.5

      parallel:
         #Hori sway
         linear 2.25 xoffset 13
         linear 2.25 xoffset -13
         #Hori sway
         linear 2.25 xoffset 13
         #Double jump
         linear 0.032 yoffset -1
         pause 0.041
         linear 0.035 yoffset 1
         pause 0.3
         linear 0.033 yoffset -1
         pause 0.15
         linear 0.03 yoffset 1
         pause 0.05
         #Hori sway
         linear 2.25 xoffset -13
         #Hori sway
         linear 2 xoffset 13
         linear 2 xoffset -13
         #Jump
         linear 0.026 yoffset -2
         pause 0.032
         linear 0.022 yoffset 2
         repeat
is the intended effect.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]