How do I position a Character sprite?

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
dmasterxd
Regular
Posts: 161
Joined: Wed Feb 19, 2014 5:05 pm
Completed: Mage Wars
Projects: Falling Star
Organization: Star Guide
Contact:

How do I position a Character sprite?

#1 Post by dmasterxd »

I've looked at the tutorials but they seriously confuse me. So does anyone know how to re-position the characters when you have more than one at the same time? Please and thank you.

User avatar
curry nochi rice
Miko-Class Veteran
Posts: 746
Joined: Sat Mar 27, 2010 3:12 am
Projects: Delicatessen, Whom to Notice, Start of Something, Love Sorcery
Organization: Circle Cosine
IRC Nick: Curry
Skype: after.curry.rice
itch: project-rothera
Contact:

Re: How do I position a Character sprite?

#2 Post by curry nochi rice »

dmasterxd wrote:I've looked at the tutorials but they seriously confuse me. So does anyone know how to re-position the characters when you have more than one at the same time? Please and thank you.
you could do:

Code: Select all

show character1 at center
show character2 at left
show character3 at right
## re-positioning
show character1 at right with moveright
show character2 at center with moveleft
## center, left. and right are already defined at 00definitions.rpy 
I think there was a behind statement but I don't quite remember how to use it.
or you could initiate/define your own positions in an init block:

Code: Select all

   
 init:
        $ rightsmile = Position(xpos=1.0, xanchor="right", ypos=0.55, yanchor="left")
and do it like:

Code: Select all

    
label start:
    show inori smile at rightsmile 
hope this helps >.<
Personal (R-13) | Now at IndieDB | Circle Cosine's itch.io
I wanna be done.

dmasterxd
Regular
Posts: 161
Joined: Wed Feb 19, 2014 5:05 pm
Completed: Mage Wars
Projects: Falling Star
Organization: Star Guide
Contact:

Re: How do I position a Character sprite?

#3 Post by dmasterxd »

curry nochi rice wrote:
dmasterxd wrote:I've looked at the tutorials but they seriously confuse me. So does anyone know how to re-position the characters when you have more than one at the same time? Please and thank you.
you could do:

Code: Select all

show character1 at center
show character2 at left
show character3 at right
## re-positioning
show character1 at right with moveright
show character2 at center with moveleft
## center, left. and right are already defined at 00definitions.rpy 
I think there was a behind statement but I don't quite remember how to use it.
or you could initiate/define your own positions in an init block:

Code: Select all

   
 init:
        $ rightsmile = Position(xpos=1.0, xanchor="right", ypos=0.55, yanchor="left")
and do it like:

Code: Select all

    
label start:
    show inori smile at rightsmile 
hope this helps >.<
Hey thanks for the help! It worked!

User avatar
Steamgirl
Veteran
Posts: 322
Joined: Sat Jul 28, 2012 4:39 am
Completed: My Cup of Coffee, Queen at Arms (co-wrote a battle scene)
Projects: Stranded Hearts, Emma: A Lady's Maid
Deviantart: steamgirlgame
Contact:

Re: How do I position a Character sprite?

#4 Post by Steamgirl »

These are ones I tend to use:

Put this at the top of the script

Code: Select all

init:
    $ midright = Position(xalign=0.75)
    $ midleft = Position(xalign=0.25)
    $ edgeright = Position(xpos=0.9,xanchor=0.5)
    $ edgeleft= Position(xpos=0.1,xanchor=0.5)
Then in your game use the following to slide them into view or move them to a different position.

Code: Select all

show your_character1 at midleft with easeinleft
show your_character2 at edgeright with easeinright
with moveleft / moveright also work, as posted above. :)

Use the following to make them leave the screen:

Code: Select all

hide your_character1 with moveoutleft

dmasterxd
Regular
Posts: 161
Joined: Wed Feb 19, 2014 5:05 pm
Completed: Mage Wars
Projects: Falling Star
Organization: Star Guide
Contact:

Re: How do I position a Character sprite?

#5 Post by dmasterxd »

Steamgirl wrote:These are ones I tend to use:

Put this at the top of the script

Code: Select all

init:
    $ midright = Position(xalign=0.75)
    $ midleft = Position(xalign=0.25)
    $ edgeright = Position(xpos=0.9,xanchor=0.5)
    $ edgeleft= Position(xpos=0.1,xanchor=0.5)
Then in your game use the following to slide them into view or move them to a different position.

Code: Select all

show your_character1 at midleft with easeinleft
show your_character2 at edgeright with easeinright
with moveleft / moveright also work, as posted above. :)

Use the following to make them leave the screen:

Code: Select all

hide your_character1 with moveoutleft
Hey thanks, yours helped also! Oh yea this game is gonna be awesome!

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: How do I position a Character sprite?

#6 Post by SundownKid »

You can also define a transform and make any character position you want that way. For example:

Code: Select all

transform left:
    xalign 0.2
    yalign 1.0
    
transform right:
    xalign 0.8
    yalign 1.0
It's a slightly easier method than putting it in the init code.

Post Reply

Who is online

Users browsing this forum: No registered users