Animation positioning using code

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
neometalero
Regular
Posts: 198
Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:

Animation positioning using code

#1 Post by neometalero »

I have this sprite

Image

Code: Select all

show AnimPlayerFondoBibliot with dissolve:
        easein 4.0 xpos 700 ypos 650
This code does this movement
Image
But I want it to do this
Image

how can I do that? Tks :mrgreen:
Working on many weird narrative games at Curse Box Studios
Image
https://www.curseboxstudios.com/

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: Animation positioning using code

#2 Post by namastaii »

Create an ATL and show the image at that transform

Code: Select all

transform mytransformname:
  alpha 0.0
  linear 1.0 alpha 1.0
  easein 4.0 pos(700,650)

Code: Select all

show AnimPlayerFondoBibliot at mytransformname
This is completely untested but this is the general idea of what you want

edit* I didn't see the rest of your question. I'm not sure how to specify where the transform starts. you probably just include the ypos at the beginning of the ATL and have it end at the correct xpos so try something like

Code: Select all

transform mytransformname:
  ypos 650
  alpha 0.0
  linear 1.0 alpha 1.0
  easein 4.0 xpos 700
or you can continue to use the code you're using if you don't want to create multiple transforms and put the ypos BEFORE the easein

User avatar
neometalero
Regular
Posts: 198
Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:

Re: Animation positioning using code

#3 Post by neometalero »

namastaii wrote: Tue Sep 03, 2019 11:14 am Create an ATL and show the image at that transform

Code: Select all

transform mytransformname:
  alpha 0.0
  linear 1.0 alpha 1.0
  easein 4.0 pos(700,650)

Code: Select all

show AnimPlayerFondoBibliot at mytransformname
This is completely untested but this is the general idea of what you want

edit* I didn't see the rest of your question. I'm not sure how to specify where the transform starts. you probably just include the ypos at the beginning of the ATL and have it end at the correct xpos so try something like

Code: Select all

transform mytransformname:
  ypos 650
  alpha 0.0
  linear 1.0 alpha 1.0
  easein 4.0 xpos 700
or you can continue to use the code you're using if you don't want to create multiple transforms and put the ypos BEFORE the easein
Tks a lot, this worked fine, I added a position x line at the beginning to start the animation at the right place

Code: Select all

transform transformPersonajeBiblio:
  ypos 650
  xpos 200
  alpha 0.0
  linear 1.0 alpha 1.0
  easein 4.0 xpos 700
Now I have just one last problem, how can I make the dissolve effect happen at the same time that the displacement? Right now it does the dissolve first and then move the image, instead of doing both at the same time.
Working on many weird narrative games at Curse Box Studios
Image
https://www.curseboxstudios.com/

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: Animation positioning using code

#4 Post by RicharDann »

neometalero wrote: Tue Sep 03, 2019 11:32 am Now I have just one last problem, how can I make the dissolve effect happen at the same time that the displacement? Right now it does the dissolve first and then move the image, instead of doing both at the same time.
Try using a couple parallel statements in your transform:

Code: Select all

transform transformPersonajeBiblio:
  ypos 650
  xpos 200
  alpha 0.0

  parallel:
    linear 1.0 alpha 1.0
  parallel:    
    easein 4.0 xpos 700
Everything inside each parallel block will start executing at the same time.
The most important step is always the next one.

User avatar
neometalero
Regular
Posts: 198
Joined: Sun Oct 23, 2016 3:51 am
Completed: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Projects: My Dream Sport Dating Simulator, Attack Helicopter Dating Simulator
Deviantart: neometalero
Contact:

Re: Animation positioning using code

#5 Post by neometalero »

RicharDann wrote: Tue Sep 03, 2019 1:32 pm
neometalero wrote: Tue Sep 03, 2019 11:32 am Now I have just one last problem, how can I make the dissolve effect happen at the same time that the displacement? Right now it does the dissolve first and then move the image, instead of doing both at the same time.
Try using a couple parallel statements in your transform:

Code: Select all

transform transformPersonajeBiblio:
  ypos 650
  xpos 200
  alpha 0.0

  parallel:
    linear 1.0 alpha 1.0
  parallel:    
    easein 4.0 xpos 700
Everything inside each parallel block will start executing at the same time.
That worked great, tks!
Working on many weird narrative games at Curse Box Studios
Image
https://www.curseboxstudios.com/

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]