Setting default anchors to characters [Answered!]

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
User avatar
yuucie
Regular
Posts: 164
Joined: Sun Jun 22, 2014 4:04 am
Completed: NaNoReNo[2015] Those Without Names
Tumblr: an-na-ko
Location: Toronto, Canada
Contact:

Setting default anchors to characters [Answered!]

#1 Post by yuucie »

Hello! I've spent about an hour googling and searching the forums but I can't find a clue to what seems to be a really simple problem.

My character sprites are full-body, which means the default anchors set them to soaring heights (they fly really high up on the screen so all I see is their legs). I've tried fixing the problem by manually inputting the anchors when they appear onscreen, like such:

Code: Select all

 show Character Neutral at Position(yanchor=0.5, ypos=0.75)
which works wonderfully, until I try to move them into a different position, like moving left on the screen.

Code: Select all

 show Character Neutral at left with move(yanchor=0.5, ypos=0.75)
The problem is I cannot manually set the position to the anchor points, so when Character slides left, he also soars into the skies again and I can't bring him down.

So I want to know how to re-define the default anchor points for characters. I don't want to manually enter "at Position (yanchors)" over and over each time I introduce a new character or change them, and I also want to be able to move them left and right without having them fly off the screens.

There has to be a way to set the default anchors when defining the chars at the start, but I just cannot for the life of me find out how to do it!

Help would be much appreciated!
Last edited by yuucie on Sun Jun 22, 2014 6:12 pm, edited 1 time in total.

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Setting default anchors to characters

#2 Post by Asceai »

Maybe set them when you define the character images?

Code: Select all

image Character Neutral:
  "character_neutral.png"
  yanchor 0.5 ypos 0.75

User avatar
yuucie
Regular
Posts: 164
Joined: Sun Jun 22, 2014 4:04 am
Completed: NaNoReNo[2015] Those Without Names
Tumblr: an-na-ko
Location: Toronto, Canada
Contact:

Re: Setting default anchors to characters

#3 Post by yuucie »

YES this is exactly what I spent over an hour looking for. I could kiss you!! Thank you!

User avatar
yuucie
Regular
Posts: 164
Joined: Sun Jun 22, 2014 4:04 am
Completed: NaNoReNo[2015] Those Without Names
Tumblr: an-na-ko
Location: Toronto, Canada
Contact:

Re: Setting default anchors to characters

#4 Post by yuucie »

Ah, it worked for when characters appeared, but when I try moving them left it seems their anchors reset again and I have no idea why.

so I have move defined as:

Code: Select all

$ move = MoveTransition(.5)
and when I start my game, the transitions are:

Code: Select all

 show Character Neutral:
        on show:
            xalign .5
            alpha 0.0
            linear 1.0 alpha 1.0
    with easeinleft
    pause .5
which moves in the character from the left, fading him in, and centers him on the screen (he isn't floating above ground due to his default anchors). But when I introduce a new character, I want him to slide to the left to make room for her. So I have:

Code: Select all

show Character Neutral at left with move
        
    show Emily neutral:
        on show:
            xalign 1.0
            alpha 0.0
            linear 1.0 alpha 1.0
            
    with easeinright
    pause .5
    
    Em "Hi!"
However, doing so does move him left, but he flies up to the corner of the screen as well and I have no idea why. I've tested a bit and it seems like the defined left is causing chars to float, but I have no idea how to counter it. Thanks for the help, I'm trying to work it out but..

EDIT: Nevermind, figured it out! Here's the solution for anyone with the same problem:

instead of using left, I just reassigned xalign like so:

Code: Select all

show Character Neutral:
        xalign 0.4

 show Emily neutral:
        on show:
            xalign 1.0
            alpha 0.0
            linear 1.0 alpha 1.0
            
    with easeinright
    pause .5
    
    Em "Hi!"
            
works beautifully :')

Post Reply

Who is online

Users browsing this forum: Rhapsy