How to set up a panning system (like Danganronpa) in Ren’py

For my next release, Serafina’s Crown, I want to use the programming knowledge I’ve accumulated from my first two games to add a lot of fun and new features to the experience. One really big thing I wanted to add was a scene in a large room that pans from one character to another, sort of like the game Danganronpa. But if you’ve ever used Ren’py, you know that setting this up isn’t easy.

Picture something like what’s in my picture above, but zoomed in so only one character shows on the screen at a time. Sounds simple, right? But this is actually difficult to achieve in Ren’py if you want to keep your characters dynamic (changing expressions or moving if needed).

I went to the Ren’py forums for help, and they suggested I try using the layer systems. It required a lot of tweaking, but I finally got it to work. So I thought I would share my system here in case anyone else finds it useful.

For reference, my background is a 5000 pixel-wide layer. My characters are sized 800 x 1200 pixels. The screen size of my game is 1280 x 720.

First, I defined my own layer called pan in the options script:


init -1 python hide:

config.layers = [ ‘master’, ‘pan’, ‘transient’, ‘screens’, ‘overlay’ ]

Then I defined camera angles and character placements using transforms in my own init code. This part required a whole lot of trial and error. The “a_characters” position the overall layer, or camera angle; the “p_characters” place the character on a certain point. For some reason, the xpos needed to be very different for each, even though you’d think they’d be the same. But these are the coordinates that worked for me:


init python:

def cameraMove(x):

global currentX
currentX = x
return currentX

transform a_center:

xpos currentX
linear 0.4 xpos -1700 yalign 0.0

transform a_Arken:

xpos currentX
linear 0.4 xpos 0 yalign 0.0

transform p_Arken:

xpos 50 yalign 0.0

transform a_Serafina:

xpos currentX
linear 0.4 xpos -1250 yalign 0.0

transform p_Serafina:

xpos 1400 yalign 0.0

transform a_Reuben:

xpos currentX
linear 0.4 xpos -2000 yalign 0.0

transform p_Reuben:

xpos 2200 yalign 0.0

transform a_Kendal:

xpos currentX
linear 0.4 xpos 1700 yalign 0.0

transform p_Kendal:

xpos -1450 yalign 0.0

I created the function cameraMove(x) so that I would have a global variable keeping track of the camera’s location. Otherwise, when the camera panned from one direction to another, it would always start at the center and *then* pan to a character (very headache-inducing). This way it’s a lot smoother each time.

And finally, here’s the code I use for the scene itself:


label Duma:

$ currentX = -1700

with None
show Arken onlayer pan zorder 1 at p_Arken
show Serafina at p_Serafina onlayer pan
show Reuben at p_Reuben onlayer pan
show Kendal at p_Kendal onlayer pan
show Duma onlayer pan zorder 0 at a_center behind Arken, Serafina, Reuben, Kendal
with dissolvea “Praise be upon the gods; praise be upon Darzia. I call to form a special session of the Royal Duma of Queen Belatrix Grandil… who can no longer preside, may she rest in peace.”
a “Members of the Petit Duma, please announce your presence.”show layer pan at a_Serafina
s “Serafina, of House Elborn.”

show layer pan at a_Reuben
r “Reuben, of House Jeridar.”

show layer pan at a_Kendal
k2 “Kendal, of House Terrace.”

show layer pan at a_Arken
show Arken 2 onlayer pan at p_Arken
a “May it be heard …”

And there you have it. The camera pans around the room from one character to the next.

I noticed that while using the layer system, you need to mention the layer and sprite placement every time (hence I couldn’t just say “show Arken 2” when he changed expressions; I needed to say “show Arken 2 onlayer pan at p_Arken.” But if it works, it works. So I’m just excited I’ll be able to pull this off!


Animating Speech

*This post is from my Tumblr a  while back, but I thought it might be useful to re-post it here!*

After creating my Serafina’s Saga animation (20 friggin minutes of animated frames), I thought I’d share some of my knowledge thus far, particularly tips and shortcuts that work for me. The images I’ll use are from this scene of the animation; watch it to see my personal speech-animation style in action.

Any aspiring animator has probably seen a diagram of mouth shapes corresponding to every consonant and vowel. I found Preston Blair’s diagrams most useful when I started out. But personally, I wanted my mouth movements to be slightly more realistic than Blair’s, which are very exaggerated. At the same time, I didn’t want to go to the anime extreme of just making a mouth flap up and down with very little emphasis.

I don’t claim to be a top expert, but I suspect that what I’ve learned so far would be useful to other people starting out, or other animators searching for a medium between Looney Tunes and Japanese anime styles. Therefore, I have gradually developed my own speech diagram and I hope you will find it useful (please forgive the fact that my current examples are drawn at a slight angle).


The good news is that for most consonants, you can get away with using a single drawing: the gritted teeth.


(K, G, H, S, Z, CH, J…)

This mouth position is my favorite because it can be the most expressive. You can turn the gritted teeth into a grin, a snarl, or a frown while the character is talking. For a sinister character, you can emphasize the jut of the canines over the bottom teeth. You can also leave the mouth in this position in between words, giving it additional exposure.

Due to the fact you will probably use this mouth position frequently and it has the potential to convey so much emotion, I suggest you put a lot of thought into how you draw hard consonants so you can use the position to its full potential.


Once you have finished developing your hard consonant mouth position, make an altered version with slightly drooped lips for what I call the soft consonant. You will probably use this for a lot of the same letters, but in the context of different words. For instance, consider how the shape of your mouth making the K sound changes between saying “I kicked” vs “walker” (okay random examples but hopefully you get the idea). When saying “I kicked,” the vowels around the K make it a hard consonant. When saying “walker,” the mouth will be in a lower, softer shape, forming the soft consonant.


Honestly, I use this position mostly for the letter L and hardly ever use it otherwise. The key is to show the top teeth and a little bit of tongue behind them. I don’t particularly like drawing it and I find that whenever I use it—for whatever reason—it looks like the character’s making the L sound, even if I’m using it for D or TH.  Of all the possibilities other than L for this position, I find that the hard or soft consonant drawings work better.


Without a doubt, this is my least favorite mouth position to draw. It necessitates those awkward creases in the lip and it makes the character look like a chipmunk. But let’s face it, sometimes they need to make the F or V sound. In which case, just go ahead and draw the damn mouth position.


This one is pretty straightforward, fortunately. The B,P, or Ms are basically just closed mouths. However, you might want to pinch the edges and narrow the lips from the neutral position (like they’re pursing or puckering) to give the sounds emphasis.



I’m putting this mouth position into its own category because it can be used for W, R, or OO sounds. Personally, I find it very hard to draw, but I always end up using it far more frequently than I expect. The key to drawing it is to form an “O” shape in the middle of the mouth, but make it small enough so the character isn’t making an OH sound. If you still have trouble, just imagine that your character is about to give someone a kiss.

Kind of like the hard and soft consonants, I usually make two versions of this position, one more exaggerated than the other or even showing teeth. Alternate between the two depending on the word, or use the less extreme positions as transitions. A mouth moving from EE to OO can be far too extreme otherwise.



Take your hard consonant mouth position, pry the mouth open, and you’ve got your basic EE or I sound. But before you claim victory, make sure to turn the mouth up at the edges, almost as if your character is smiling. This will distinguish it from the next position.


When making the A or EH sound, the mouth pinches slightly at the edges, giving it a reverse slope of the EE position.  Occasionally, you might need to make more versions that are even wider or narrower. If you need to make this position more extreme, don’t show the bottom teeth, and maybe show a little bit of tongue in the back of mouth. In which case you’re shifting it towards the next mouth position…


This position is another awkward one to draw, because either you show the tongue way in the back of the mouth, or you hide it and thus make the whole mouth look like a drooping black hole. I leave that to your discretion. But make sure you give that arching shape to the top and lower lip, implying the AH or UH sounds. Pretend your character is opening his or her mouth for a doctor’s thermometer.


And at long last, here is the OH position, which basically forms a wide oval. Similar to AH position, you might want to show a tongue in this drawing so it’s not a huge black hole, but I usually choose not to, because the big black hole is partially what distinguishes the OH sound.


And that pretty much wraps it up! But first, a few more tips:

  • One of my most frequent mistakes starting out was to close the mouth whenever the character paused between words. I soon realized this wasn’t very natural, especially when I put it VA recordings over it. People usually breathe or leave their mouths slightly open between words. When in doubt, use the hard or soft consonant positions to fill pauses!
  • Don’t draw every single letter in a word; it simply isn’t necessary, and will probably make the character look ridiculous. Watch yourself in a mirror saying the words and figure out which sounds your mouth emphasizes. Then pick which mouth positions to draw and utilize.
  • On the other hand, sometimes you will need to use two mouth positions for one sound. For instance, I provided one mouth position for “OH,” but if I actually animated the word “OH,” the OH mouth position would be followed by the OO position. Usually you just have to feel this out as you go.
  • Although I’ve provided most of the mouth positions I use here, sometimes I need to draw a lot of in-betweens. Stay flexible and be willing to draw more in-between positions if these just aren’t cutting it.
  • On a more technical note, I suggest animating the frames in Photoshop’s timeline and then bringing them into After Effects for timing. Right click on your movie and choose “Enable Time Remapping” to start matching the mouth movements to your sound clip. Once you do that, you might need to go back into Photoshop for tweaking, but it will save you the hassle of trying to figure out all the timing on your own.

All right, that’s all I’ve got for now! I hope you find this helpful!