Ren'Py pause and time and such [SOLVED]

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.
Message
Author
User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Ren'Py pause and time and such [SOLVED]

#1 Post by TellerFarsight » Tue May 15, 2018 8:40 am

Is there a python statement in Ren'Py that I can use to create some sort of time delay, without causing an interaction like renpy.pause() does? "time" is only within the image definition as far as I understand, and "timer" is for screens. The problem I'm having is that this doesn't allow more than one thing to move at once, and the textbox is hidden until the animation finishes. I'm doing it within a python block, so is there some renpy.something I can use here?
Last edited by TellerFarsight on Tue Jun 05, 2018 10:50 pm, edited 1 time in total.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Ren'Py pause and time and such

#2 Post by kivik » Tue May 15, 2018 9:15 am

Are you trying to cause the delay for a Displayable? Since you're mentioning animation finishing I'm guessing that it is, if so why not use transforms? https://www.renpy.org/doc/html/atl.html

The pause within a transform doesn't not pause interaction, so everything will continue playing. You can have parallel pauses happening across multiple images at once as well.

If you can show us an example of what you're trying to achieve, we can better assess the best approach.

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Ren'Py pause and time and such

#3 Post by TellerFarsight » Tue May 15, 2018 6:24 pm

I'm using a python function to have characters walk to various places around the screen. Without really delving into the entire code, It basically shows a displayable animation of a character taking a step, and then shows it again one step forward. Repeat until they reached where they were trying to walk to, and then they stop. Using purely transforms, which I tried to do originally, had the character treadmilling and not really walking in a way I thought looked good. In order to do this, I had to make a function that calculated the character's position and stuff like that.

You can see a video of what I'm doing by clicking the "Vora" link in my signature here.

A character's step takes 0.8 seconds as I've said it up now, so I have basically
while current_position != destination:
renpy.show(whatever_displayable)
renpy.pause( 0.8 )
current_position = current_position + step_length

without the renpy.pause(), it would essentially just teleport the character to the destination, because it has no time to show the displayable. The pause is to make the full step be shown, and then the next iteration goes. The problem is that the pause applies to the entire screen, and so I can't show a new displayable during this pause, it just plays the already existing ones. I don't know how, with a transform instead of a function, have this step-by-step animation with "time" instead of "pause"

I'll see if I can sort of, put this function inside an ATL block and have it work that way somehow.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Ren'Py pause and time and such

#4 Post by kivik » Tue May 15, 2018 7:49 pm

Very pretty game!!

Looking at your code, it doesn't look very low level python, it looks like you can actually do it with Renpy statements:

Code: Select all

while current_position < destination: # changed that to less than just in case adding step_length can exceed destination?
    show expression whatever_displayable
    pause 0.8
    $ current_position += step_length # shorthand of your statement
However, that's just to duplicate what you just posted with minor tweaks. You may already know the reason without pause it "teleports" because it's jumping to the next statement without interaction - hence the next show statement in the while loop until it reaches the end.

Now to achieve what you want, and someone more experience may be able to give a better answer, here's what I'd do:

Avoid the loop, because the loop will trigger the next show statement on each iteration which skips your animation.

Create a transform that is your animation, and pass the number of steps and distance in

Code: Select all

transform walking(steps, x_pos):
    parallel:
        linear steps * 0.8 xpos x_pos
    parallel:
        # do your animation frames here
        "frame1.png"
        pause 0.2
        "frame2.png"
        pause 0.2
        "frame3.png"
        pause 0.2
        "frame4.png"
        pause 0.2
        "frame5.png"
        repeat steps
I'm using this thread for inspiration: viewtopic.php?t=27359 I'm not sure if there's a better way now.

So now you calculate the number of steps required, the distance your character has to travel, and put that in when you show the image - once:

Code: Select all

show expression walking(10, player.xpos + 10 * 20)() as player
I'm not sure where you keep the character xpos, how far each step goes and what not, so I'm doing complete guess work here, say 20pixels per step. Obviously I haven't factored in things like whether you're walking left or right, and other things. But hopefully the basic concept is there.

As the other thread said - you can show a transform as an image using the expressing above, with the advantage of being able to pass variables into your transform (which you can't do for images). So it should hopefully achieve what you want!

I've not tested this as I don't have the assets to play with, but it should in theory play out whilst the game continues the next dialogue.

I do see potential issues in terms of polishing the minor things, and all the scenarios you may come across during user interactions. But if the above works then it should form the basis of what you need to do next :)

Good luck and please let me know if it works!

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Ren'Py pause and time and such

#5 Post by TellerFarsight » Tue May 15, 2018 8:46 pm

This is basically the code I'm using right now. Glad you responded when you did; I was just about to go down the rabbit hole of trying to pass a varaible to an image. I'm trying to do what I said before, putting essentially this function into a transform, but there were a few things I was confused about until you responded. I'll try and sort it out using what you said.

Code: Select all

class Vivor:
        def __init__(self,name,height,stride1,stride2,right_xa,left_xa):
            self.name = name
            self.xpos = None
            self.ypos = None
            self.height = height*3
            self.stride1 = stride1*3
            self.stride2 = stride2*3
            self.right_xa = right_xa*3
            self.left_xa = left_xa*3
            
        def talk_right(self,zord):
            renpy.show(self.name + " right stand", at_list=[current_pos(self.xpos,self.ypos,self.right_xa,0)], zorder=zord)
        def talk_left(self,zord):
            renpy.show(self.name + " left stand", at_list=[current_pos(self.xpos,self.ypos,self.left_xa,0)], zorder=zord)
            
        def move(self,type,endx,endy,zord):
            x = self.xpos
            y = self.ypos
            if type == "walk":
                stride = self.stride1
            if type == "run":
                stride = self.stride2
            if x < endx:
                direction = "right"
            if x > endx:
                direction = "left"
            renpy.show(self.name+" "+direction+" stand", at_list=[current_pos(x,y,getattr(self,direction+"_xa"),0)], zorder=zord)
            renpy.pause(0.5)
            renpy.show(self.name+" "+direction+" stand_to_"+type, at_list=[current_pos(x,y,getattr(self,direction+"_xa"),0)], zorder=zord)
            renpy.pause(0.1)
            while x != endx:
                ydiff = (endy-self.ypos)/(abs(endx-self.xpos)/stride)+1
                if abs(endx-x) > stride:
                    renpy.show(self.name+" "+direction+" "+type, at_list=[current_pos(x,y,getattr(self,direction+"_xa"),ydiff)], zorder=zord)
                if abs(endx-x) <= stride:
                    break
                if y != endy:
                    y = y+ydiff
                renpy.pause(0.8)
                if direction == "right":
                    x = x+stride
                if direction == "left":
                    x = x-stride
            renpy.show(self.name+" "+direction+" "+type+"_to_stand", at_list=[current_pos(x,y,getattr(self,direction+"_xa"),0)], zorder=zord)
            if type == "walk":
                renpy.pause(0.1)
            if type == "run":
                renpy.pause(0.3)
            renpy.show(self.name+" "+direction+" stand", at_list=[current_pos(x,y,getattr(self,direction+"_xa"),0)], zorder=zord)
            self.xpos = x
            self.ypos = y
            
    Aggy = Vivor("aggy",39,22,65,16,69)

define ag = Character("Aggy", image="aggy", callback=partial(talking_stick,Aggy))
    
transform current_pos(x,y,xanch,ydiff):
    xanchor xanch
    yanchor 1.0
    pos (x,y)
    linear 0.8 pos (x,y+ydiff)
    
label start:
    #stuff that's not important here
    $ Aggy.move("walk",100,630,61)
    
    
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Ren'Py pause and time and such

#6 Post by TellerFarsight » Tue May 15, 2018 9:50 pm

I did a quick little thing to try and test out what works and what doesn't, and I don't understand the problem. I wrote the error down there at the bottom. It's having issues with me trying to define "x" and "y" at the beginning, for some reason.

Code: Select all

transform move(char,type,endx,endy,zord):
            x = char.xpos
            y = char.ypos
            xanchor xanch
            yanchor 1.0
            if type == "walk":
                stride = char.stride1
            if type == "run":
                stride = char.stride2
            if x < endx:
                direction = "right"
            if x > endx:
                direction = "left"
            "aggy right stand"
            pos (x,y)
            0.5
            "aggy right stand_to_walk"
            pos (x,y)
            0.1
            while x != endx:
                ydiff = (endy-char.ypos)/(abs(endx-char.xpos)/stride)+1
                if abs(endx-x) > stride:
                    "aggy right walk"
                    pos (x,y)
                    linear 0.8 pos (x,y+ydiff)
                    0.8
                if abs(endx-x) <= stride:
                    break
                if y != endy:
                    y = y+ydiff
                if direction == "right":
                    x = x+stride
                if direction == "left":
                    x = x-stride
            "aggy right walk_to_stand"
            pos (x,y)
            if type == "walk":
                0.1
            if type == "run":
                0.3
            "aggy right stand"
            pos (x,y)
            char.xpos = x
            char.ypos = y
            
    # File "game/Proving Grounds.rpy", line 2: expected 'comma or end of line' not found.
    #    x -> = char.xpos
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Ren'Py pause and time and such

#7 Post by kivik » Wed May 16, 2018 4:43 am

I think you can't declare variables inside a transform, I expect the same for while loops and conditions. That's why I've simplified the transform to two components:
1 - linear movement from one position to the next
2 - a loop of the walking animation


By quick glancing your code it looks like your main problem is looping the animation outside the transform / image - am I right that the "aggy right walk" image is already animated? And you're just changing the speed at which your character moves across the screen depending on whether they're walking or running.

So the original issue you were having is that you've got a loop outside of the animation, and repeatedly doing a show image from your loop, which means each subsequent image overwrites the previous at the speed that the loop is executed (which is very fast these days!)

I'm going to do a two part approach to this to hopefully explain how to use transforms and animations together. Part one will ignore the starting and stopping animation:

If you've got the animation loop "aggy right walk" already, that's a good start. When Aggy walks, we want to show this image, and we want to move him across the screen. He'll do the walking animation if we just show the image, but if we add a transform to him, he'll walk across the screen from left to right. So our transform will look something like this:

Code: Select all

transform move(duration, start_x, start_y, end_x, end_y):
    xpos start_x
    ypos start_y
    linear duration xpos end_x ypos end_y
We'd run the animation like this:

Code: Select all

show aggy right walk at move(4, 50, 400, 500, 400)
"hello world!"
This should move Aggy across the screen and immediately show the narration whilst Aggy continues to move.

Problem is now, Aggy will walk on the spot at the end. We can't do the following:

Code: Select all

show aggy right stand_to_walk
show aggy right walk at move(4, 50, 400, 500, 400)
show aggy right walk_to_stand
We can't do that because we run into the same problem as before where only show aggy right walk_to_stand will be shown. This is where we're going to do what we learnt in the last post and put it into practice - we're going to use a transform as an image.

Part two:

Well the cool thing about transform is that you can put an image in the transform:

Code: Select all

transform move(duration, start_x, start_y, end_x, end_y):
    xpos start_x
    ypos start_y
    "aggy right walk"
    linear duration xpos end_x ypos end_y

label start:
    show expression move(4, 50, 400, 500, 400)() as aggy
This should do exactly the same thing as our part one code, only we're loading aggy's walking animation into our transform. Sweet! That means we can add the starting and ending animations as well:

Code: Select all

transform move(start_duration, duration, start_x, start_y, end_x, end_y):
    xpos start_x
    ypos start_y
    "aggy right stand"
    pause 0.5
    "aggy right stand_to_walk"
    pause start_duration
    "aggy right walk"
    linear duration xpos end_x ypos end_y
    "aggy right walk_to_stand"
    pause start_duration
    "aggy right stand"

label start:
    show expression move(0.1, 50, 400, 500, 400)() as aggy # walk
    show expression move(0.3, 50, 400, 500, 400)() as aggy # run
I'm actually not to clear on if I'm getting this bit right as I'd have thought that walking should have a longer pause than running, but you have 0.1 for walking and 0.3 for running. I may have misread it since I've just woken up!

Now your python / renpy code will actually do something completely different: work out those parameter's values. You should be able to do that using your existing code - but instead of looping and showing animations per stride, you work out the entire duration of the animation based on the distance.

Part Three: bonus

We still have one problem with our transforms, they're all doing aggy right, what if we want left? Text interpolation to the rescue!

Code: Select all

transform move(direction, start_duration, duration, start_x, start_y, end_x, end_y):
    xpos start_x
    ypos start_y
    "aggy [direction] stand"
    pause 0.5
    "aggy [direction] stand_to_walk"
    pause start_duration
    "aggy [direction] walk"
    linear duration xpos end_x ypos end_y
    "aggy [direction] walk_to_stand"
    pause start_duration
    "aggy [direction] stand"

label start:
    show expression move("right", 0.1, 50, 400, 500, 400)() as aggy # walk
    show expression move("left", 0.1, 500, 400, 50, 400)() as aggy # walk

I've tested this with my own very basic animation of a blinking eye that I made from a while back for another post, but it works in terms of executing the animation loop as intended - I'm not sure how much tweaking is needed for yours - but hopefully it does exactly what you need it to do!

Also I hope you didn't mind me breaking it down into steps - as I'm under the impression that you'd need to reuse the same concept in other places in your game, so I wanted to explain how it works more than how to do it!

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Ren'Py pause and time and such

#8 Post by TellerFarsight » Wed May 16, 2018 8:56 am

What you're describing is what I originally did late last year when I started this project, but the result was a character that was "treadmilling," as in they did a walking animation and also slid across the screen but the movement didn't match the footfalls. This is often accepted with no problems for games with a dynamic camera; treadmilling makes it so that the camera can move smoothly. My game, however, has a static camera, and so the treadmilling style looks amateurish and lazy. That's why I had to create this function to do it without using transform's linear warper.
If you can't do variables, conditions, or while loops and other python statements within a transform, then I might have to drastically rethink this or give it up. I'd rather sacrifice multiple character movement than the more realistic looking walking. It's only meant to be supplemental, it is usually only one character moving. If it comes down to it, I can directly define some images of characters, say, walking 3 steps to the right, and have that go secondarily while the primary character walks somewhere. Perhaps if I do this, ways of condensing it will become more obvious. As I've learned with programming, pretty much anything I want is possible, it's only a matter of doing it efficiently.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Ren'Py pause and time and such

#9 Post by kivik » Wed May 16, 2018 9:33 am

Ah fair enough - there may be another way of doing it using pauses and repeat - so instead of using a linear movement, you do a pause, then xoffset and yoffset. And apparently you can use contains to mix transforms together, so I think it's still feasible.

Pseudo code version (non working code) would probably look something like:

Code: Select all

transform move(*args):
    xpos start_x
    ypos start_y
    "aggy [direction] stand"
    pause 0.5
    "aggy [direction] stand_to_walk"
    pause start_duration
    contains walking(steps)
    "aggy [direction] walk_to_stand"
    pause start_duration
    "aggy [direction] stand"

transform walking(steps):
    "frame1.png"
    xoffset 5
    pause 0.1
    "frame2.png"
    xoffset 5
    pause 0.1
    "frame3.png"
    xoffset 5
    pause 0.1
    "frame4.png"
    xoffset 5
    pause 0.1
    "frame5.png"
    xoffset 5
    pause 0.1
    repeat steps
Have a look at this thread: viewtopic.php?t=17641

If I have time later and you haven't gotten far with it, I'll have a play myself.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Ren'Py pause and time and such

#10 Post by kivik » Wed May 16, 2018 3:30 pm

So I had a play with xoffset and it looks like it doesn't accumulate, so I went back to the documentations and read up on the transform functions, and I think it's what you're after:

https://www.renpy.org/doc/html/atl.html ... -statement

Instead of a python function that executes the show statement on a loop, a transform function executes inside a transform and can manipulate the the transform directly.

I'm having a play with it now but I'm convinced this is the solution. Shame nobody else has chipped in yet as I think someone cleverer than me would have had the solution already!

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Ren'Py pause and time and such

#11 Post by kivik » Wed May 16, 2018 4:20 pm

Ok so I had a play and I've got something working based on number of loops (I called the parameter steps but that's not technically correct), you should be able to modify this to exactly what you need if you want more granular control. I've learnt a few new things from this:

transform function, lets you manipulate the transform with python code: https://www.renpy.org/doc/html/atl.html ... -statement
All the transform properties should be available for manipulation: https://www.renpy.org/doc/html/atl.html ... properties

block statement: https://www.renpy.org/doc/html/atl.html#block-statement
This was a stumbling block for me at first - I figured there must be a way of having non-repeated frames in an animation loop, turns out you just put the loop in a block!

I haven't explored further with the st and at arguments (you need to keep them) but I don't think it's necessary for your animation loop? You'll also need two functions, one to go left and one to go right - as I don't know how you'd pass an additional parameter to the function!

Code: Select all

transform walk(start_x, start_y, steps, speed=0.1):
    xpos start_x ypos start_y
    "standing-right.png"
    pause speed
    block:
        "walk-right_01.png"
        function step_function
        pause speed
        "walk-right_02.png"
        function step_function
        pause speed
        "walk-right_03.png"
        function step_function
        pause speed
        "walk-right_04.png"
        function step_function
        pause speed
        "walk-right_05.png"
        function step_function
        pause speed
        "walk-right_06.png"
        function step_function
        pause speed
        repeat steps
    "standing-right.png"

init python:
    def step_function(trans, st, at):
        trans.xoffset += 11

image bg = Solid("#000")

label start:
    python:
        x, y = (-50, 700)
    scene bg
    while True:
        show expression walk(x, y, 5)() as walk
        "Starting xpos: [x]"
        $ x += 5*6*11
    return
Attached are here:
images.zip
(87.12 KiB) Downloaded 6 times
Here's the in game animation loop:

Image

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Ren'Py pause and time and such

#12 Post by TellerFarsight » Wed May 16, 2018 8:45 pm

Ok. So. I've started on it and it looks like it's totally possible.

Code: Select all

# within a python block
    def cycleoff(trans, st, at):
        trans.xoffset -= 90
        ### diana's walking stride length is 90 pixels, so I need to
        ### find a way to have this be changeable per character, 
        ### or I'll have to just make multiple.

transform walk(char, direction, steps):
    xpos char.xpos ypos char.ypos
    char.name+" "+direction+" stand"
    pause 0.5
    char.name+" "+direction+" stand_to_walk"
    pause 0.1
    block:
        char.name+" "+direction+" walk"
        pause 0.8
        function cycleoff
        repeat steps
    char.name+" "+direction+" walk_to_stand"
    pause 0.1
    char.name+" "+direction+" stand"
    ### I've made it so character and direction can be passed,
    ### and I'll be able to have "walk/run" be passable too with a bit of work.
    
    ### within the actual game script
    $ Diana.xpos = 1251
    $ Diana.ypos = 626
    $ Diana.move("walk",1100,626,61) # Here's how movement is normally called, by specifying a type of movement, a destination(x,y), and the zorder
    pause
    show expression walk(Diana,"left",5)() as diana #Here's the transform call, where I need to name number of steps instead of destination, which is fine.
    di "Hmm... It looks like the lights are still flickering a bit."
Counting number of steps instead of specifying destination is a little different from what I was doing, but it's not too different, so I might be able to overhaul the entire program this way. There are a few annoying things about it, like figuring out how to store the current_position data and passing character stride lengths to the function. I'll see if I can work those out.

Also, the original thing I wanted, two characters walking at once, totally works!

Code: Select all

    show expression walk(Diana,"left",5)() as diana
    show expression walk(Deborah,"left",4)() as deborah
You'll be able to see it in the next update video I post, but I have to get some other stuff finished before I make that. I'll let you know if I find out anything new about it. Super Thanks!
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

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

Re: Ren'Py pause and time and such

#13 Post by philat » Wed May 16, 2018 10:32 pm

Dropping in to note that you can curry the function to pass in more arguments (like stride).

Code: Select all

init python:
    def cycleoff(trans, st, at, stride=11):
        trans.xoffset -= stride # shouldn't this be xpos?
        # I'd assume you could pass in the character and update the char.xpos in here as well

    cycleoff_curried = renpy.curry(cycleoff)

transform walk(char, direction, steps):
    xpos char.xpos ypos char.ypos
    char.name+" "+direction+" stand"
    pause 0.5
    char.name+" "+direction+" stand_to_walk"
    pause 0.1
    block:
        char.name+" "+direction+" walk"
        pause 0.8
        function cycleoff_curried(stride=90) # this
        repeat steps
    char.name+" "+direction+" walk_to_stand"
    pause 0.1
    char.name+" "+direction+" stand"
Last edited by philat on Thu May 17, 2018 4:56 am, edited 1 time in total.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Ren'Py pause and time and such

#14 Post by kivik » Thu May 17, 2018 3:28 am

Nice! One last thing, you should be able to make your code more readable with text interpolation:

Code: Select all

"[char.name] [direction] stand"
Thanks for the curried function as well philat, that's what I couldn't figure out!

Regarding the xpos vs xoffset, in the context of the function both gets the same result - I think one is absolute and the other relative to starting position so the increment or subtraction results in the same outcome.

User avatar
TellerFarsight
Veteran
Posts: 230
Joined: Sun Jun 04, 2017 8:09 pm
Projects: Vora, Secrets Untold
Location: Toronto, ON
Contact:

Re: Ren'Py pause and time and such

#15 Post by TellerFarsight » Thu May 17, 2018 9:07 am

I think there's a problem with the offset here, and I can't figure it out. I recorded a gif of what happens with this code. The character is supposed to walk to the right, stop, and then continue walking right. Instead what happens is she resets to the first position and walks again. The char.xpos value is still calculated as expected, as shown by the little screen I put on screen, and the textbox indicator that appears at the position when that character talks. I tried adding another function that resets trans.offset to 0, but that didn't really work either.
Also, text interpolation has a problem with [char.name], so I'll leave it as is for now.

Code: Select all

### within a python block
    def cycle(trans, st, at, char):
        trans.xoffset -= char.stride1
        char.xpos -= char.stride1
    cycle_curried = renpy.curry(cycle)

transform walk(char, direction, steps, hold):
    pos (char.xpos,char.ypos)
    yanchor 1.0
    xanchor getattr(char,direction+"_xa")
    char.name+" "+direction+" stand"
    pause hold
    char.name+" "+direction+" stand_to_walk"
    pause 0.1
    block:
        char.name+" "+direction+" walk"
        pause 0.8
        function cycle_curried(char=char)
        repeat steps
    char.name+" "+direction+" walk_to_stand"
    pause 0.1
    char.name+" "+direction+" stand"

### within game script
    $ Diana.xpos = 1251
    $ Diana.ypos = 626
    $ Diana.move("walk",1100,626,61)
    pause
    show expression walk(Diana,"left",5,0.5)() as diana
    di "Hmm... It looks like the lights are still flickering a bit."
    di "They really should get that fixed."
    
    $ Deborah.xpos = 1300
    $ Deborah.ypos = 641
    $ Deborah.move("walk",1150,641,61)
    de "Meh. They've been like that for years, no one's going to blame us for them."
    show expression walk(Diana,"left",5,0.5)() as diana
    show expression walk(Deborah,"left",4,0.7)() as deborah
    de "Don't worry about it."
VoraTest.gif
You can click on it to see it better.
Current Project: Vora
Also Check Out: Devil Survivor [Reverse-Engineered]

Post Reply

Who is online

Users browsing this forum: Google [Bot]