[SOLVED] Animating based of previous given location

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
Exiscoming
Regular
Posts: 127
Joined: Tue Apr 29, 2014 5:37 pm
Contact:

[SOLVED] Animating based of previous given location

#1 Post by Exiscoming » Fri Jul 12, 2019 5:36 pm

Right, let me try and explains this the best I can. I'd like to re-use an animation but the starting point of the animation needs to change.
So for example:

Code: Select all

default xposAni = 50
default yposAni = 50

transform itemDrop:
    xpos = xposAni ypos = yposAni
    linear 0.3 ypos -20
    linear 0.3 ypos +20
    linear 0.6 xpos 1280 ypos 0
The idea behind the above code would be that it starts at position 50px50px then flies up for 20px, comes down by 20px and then flies off to the top right corner of the screen. So is there a way to do this? Also having 1 variable for both the xposition and the yposition would be really handy.
Last edited by Exiscoming on Sat Jul 13, 2019 2:29 pm, edited 1 time in total.

drKlauz
Veteran
Posts: 237
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: Animating based of previous given location

#2 Post by drKlauz » Fri Jul 12, 2019 6:09 pm

Something like i guess:

Code: Select all

transform item_drop(pos):
  pos pos
  yoffset 0
  linear 0.3 yoffset -20
  linear 0.3 yoffset 0
  linear 0.6 pos(1280,0)

label start:
  show banana at item_drop((300,300))
  'testing'
  return
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350

Exiscoming
Regular
Posts: 127
Joined: Tue Apr 29, 2014 5:37 pm
Contact:

Re: [SOLVED] Animating based of previous given location

#3 Post by Exiscoming » Sat Jul 13, 2019 2:29 pm

Thank you very much! This'll help me clean up my code a bit.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]