Can't move a character?

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
gamajorbatistan
Regular
Posts: 35
Joined: Sun Mar 04, 2018 3:57 am
Contact:

Can't move a character?

#1 Post by gamajorbatistan »

Why does nothing work with RenPy? It's beyond stunning how no matter what you do and try, nothing works. You can read the documentation and study old answers to similar questions, and it does absolutely nothing for you because no matter what you try to do with your code, it will simply not work. Awesome!

So I'm trying to show a character and have them move in from the left to a predefined position called 'slightleft'. I define it in my init: like so

Code: Select all

    transform slightleft:
        xalign 0.33
        yalign 0.65
so far so good. Then I do this:

Code: Select all

    show dudebro at slightleft
    with moveinleft
and he moves into the center. Wow! Awesome! Thank you RenPy, that's exactly what I wanted! That's why I predefined a position that is not the center, so you can ignore it and move to the center! Great!

But that's not even the fun part. The fun part is when I now try to move that character to (anywhere will do it's all equally broken) let's say slightright

Code: Select all

    transform slightright:
        xalign 0.66
        yalign 0.65

Code: Select all

    show image dudebro:
           xalign 0.66 yalign 0.65
           linear 1.0 xalign 0.33
Nothing happens. It's all so fucked and the documentation is so useless. Nothing works in it. I've tried countless bits of code and had to play riddle games with it trying to figure out which part of the code I was meant to change so I can have it work.

Please for all that is holy. Is there a sample script where I can study how a character is shown into a positionA and then moved from there to a positionB ? How can that be so hard?

User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

Re: Can't move a character?

#2 Post by korova »

1) Take a deep breath...
I understand that sometimes, at the beginning, any programming language can be frustrating, but Renpy works juste fine.
It will take some time and patience to wrap your head around renpy logic, but so far, I've always manage to make renpy do what I wanted.

2) I think at least one of these two options should work

Code: Select all

# your move definition

transform slightright:
    xalign 0.66 yalign 0.65
    linear 1.0 xalign 0.33

## later in code

    show dudebro at slightright

Code: Select all

    show dudebro:
        xalign 0.66 yalign 0.65
        linear 1.0 xalign 0.33

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Can't move a character?

#3 Post by Remix »

A little more explanation:

Code: Select all

transform move_image:
    # these initial settings just define a start position (and anchor)
    anchor (1.0, 1.0) # base right
    xalign 0.0 # left side of screen (with anchor 1.0, this sets the right side of image at screen left, so basically off the screen)
    yalign 0.65
    #
    # now some movement
    #
    linear 1.0 xalign 0.33 # use a linear warper to move to new position in 1.0 seconds
    pause 1.0
    ease_elastic 2.0 xalign 0.66 # a bouncy move for 2.0 seconds 
    pause 1.0
    easeout_back 1.0 yalign 0.0 # a slight bounce then off the top of the screen
Hopefully it will help you understand the idiom of a transform starting by setting a position and then doing some movement from that point.
Frameworks & Scriptlets:

gamajorbatistan
Regular
Posts: 35
Joined: Sun Mar 04, 2018 3:57 am
Contact:

Re: Can't move a character?

#4 Post by gamajorbatistan »

Well, thanks for helping me out. But boohoo who would have thought, it's not working.

It's now telling me that my image is not defined. It is though. Funny how things are with RenPy.

'show dudebro at center' works just fine in line 470
and then suddenly in 484 'show dudebro at slightleft' gives me HURRDURR YOU DIDN'T DEFINE DUDEBRO.

Why would RenPy do that??






Remix wrote: Sun Mar 04, 2018 10:47 am A little more explanation:

Code: Select all

transform move_image:
    # these initial settings just define a start position (and anchor)
    anchor (1.0, 1.0) # base right
    xalign 0.0 # left side of screen (with anchor 1.0, this sets the right side of image at screen left, so basically off the screen)
    yalign 0.65
    #
    # now some movement
    #
    linear 1.0 xalign 0.33 # use a linear warper to move to new position in 1.0 seconds
    pause 1.0
    ease_elastic 2.0 xalign 0.66 # a bouncy move for 2.0 seconds 
    pause 1.0
    easeout_back 1.0 yalign 0.0 # a slight bounce then off the top of the screen
Hopefully it will help you understand the idiom of a transform starting by setting a position and then doing some movement from that point.
Okay, so I put this in my init definitions and then when I want to move dudebro from the middle to the side what do I write?

Code: Select all

show dudebro left
with move_image
    xalign 0.0
    yalign 0.65
? I can tell you already that that's not going to work and I don't even need to try it to know that lol. Not that I even could try it, because RenPy decided to just pretend I didn't define the image for dudebro when it showed it working properly 20 lines of code earlier. What is going here? How does anyone ever finish anything with RenPy when the simplest of things require the will of god and a whole bunch of luck to work? Surely that's not how RenPy development is meant to be.
Last edited by gamajorbatistan on Sun Mar 04, 2018 11:05 am, edited 1 time in total.

User avatar
78909087
Veteran
Posts: 277
Joined: Sat Aug 16, 2014 2:33 pm
Completed: Dungeons and Don't Do It, Wake Up
Projects: Lethe
IRC Nick: Pacermist
Contact:

Re: Can't move a character?

#5 Post by 78909087 »

Can you PM me your code? I'll have a quick look.
I am not friends with the sun.
Image

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Can't move a character?

#6 Post by xavimat »

The bits of code you have shown will work just fine if you put them in the right part. We can only guess what the problem is, but it is not in the code we can see.

I see your transform has an indentation it shouldn't have. Are you defining transforms inside a label?
When the game starts, renpy loads a lot of things in the INIT phase:
init, init python, default, define, transform, style.
Later, in the labels, you can use the transforms.

Are you, maybe, using "show" inside a screen?

Please, show a little bit more of your code, so we can help you.

This code (copied from yours) works just fine:

Code: Select all

transform slightleft:
    xalign 0.33
    yalign 0.65

label start:
    scene bg somewhere with None

    show dudebro at slightleft
    with moveinleft

    pause
    return
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Can't move a character?

#7 Post by Remix »

Without seeing how and where you are defining dudebro we can only guess at any help...

For most images, a simple:

Code: Select all

image some_name = Image("images/bg 0.png")
# or perhaps
define heart = AlphaDissolve(DynamicDisplayable(heart_func), 1.0)
... outside of any label or screen should be fine (as long as the reference name isn't re-used/re-defined elsewhere)
Frameworks & Scriptlets:

gamajorbatistan
Regular
Posts: 35
Joined: Sun Mar 04, 2018 3:57 am
Contact:

Re: Can't move a character?

#8 Post by gamajorbatistan »

Really confused now... I added something seemingly irrelevant. Now RenPy properly notices the defined image. Then I delete that same seemingly irrelevant bit of code, and now RenPy still notices the defined image. But it didn't do so before adding and deleting the irrelevant code. Is that even possible?

User avatar
78909087
Veteran
Posts: 277
Joined: Sat Aug 16, 2014 2:33 pm
Completed: Dungeons and Don't Do It, Wake Up
Projects: Lethe
IRC Nick: Pacermist
Contact:

Re: Can't move a character?

#9 Post by 78909087 »

I have responded to your PM, has your code encountered any other errors?
I am not friends with the sun.
Image

gamajorbatistan
Regular
Posts: 35
Joined: Sun Mar 04, 2018 3:57 am
Contact:

Re: Can't move a character?

#10 Post by gamajorbatistan »

xavimat wrote: Sun Mar 04, 2018 11:05 am The bits of code you have shown will work just fine if you put them in the right part. We can only guess what the problem is, but it is not in the code we can see.

I see your transform has an indentation it shouldn't have. Are you defining transforms inside a label?
When the game starts, renpy loads a lot of things in the INIT phase:
init, init python, default, define, transform, style.
Later, in the labels, you can use the transforms.

Are you, maybe, using "show" inside a screen?

Please, show a little bit more of your code, so we can help you.

This code (copied from yours) works just fine:

Code: Select all

transform slightleft:
    xalign 0.33
    yalign 0.65

label start:
    scene bg somewhere with None

    show dudebro at slightleft
    with moveinleft

    pause
    return
Well no, it's not working. I can dudebro to appear in the center and I cannot do anything to get him to move to slightleft. Nothing is working. Literally every sprite I call in stacks one upon the other in the center and it makes absolutely no sense.

gamajorbatistan
Regular
Posts: 35
Joined: Sun Mar 04, 2018 3:57 am
Contact:

Re: Can't move a character?

#11 Post by gamajorbatistan »

If I have a character appear, like so

show dudebro right

and then I make this

show dudebro left

is that how I make dudebro transition from the right to the left? or would that spawn a second dudebro? obviously for me it doesn't do anything because nothing works for me but I'm struggling to even figure out what the normal way to do this would be. how would I have a character come in from either side, sit at the middle, say some phrases, and then move to the stupid left? it's not asking so much really. i should specifiy that i would like the already existing character to move.

gamajorbatistan
Regular
Posts: 35
Joined: Sun Mar 04, 2018 3:57 am
Contact:

Re: Can't move a character?

#12 Post by gamajorbatistan »

The exact same code in a different test game works perfectly. And in my stupid fucking game it just ignores it. What in gods cock? I'm so done with this.

gamajorbatistan
Regular
Posts: 35
Joined: Sun Mar 04, 2018 3:57 am
Contact:

Re: Can't move a character?

#13 Post by gamajorbatistan »

Testing some stuff and, is it possible that RenPy does not treat the image middle point as its 'origin' ? Does it somehow change the image 'origin' on a wim inbetween lines of code? Something like that has to be going on.

gamajorbatistan
Regular
Posts: 35
Joined: Sun Mar 04, 2018 3:57 am
Contact:

Re: Can't move a character?

#14 Post by gamajorbatistan »

I think I figured it out. It was indeed related to anchors. Once I set them properly (which the documentation doesn't even attempt to showcase) things work as intended.

Code: Select all

    show dudebro at fullleft:
        xanchor 0.5 yanchor 0.5
Thanks for help nonetheless!

Post Reply

Who is online

Users browsing this forum: No registered users