Question regarding using lerp with start relative endpoints

10 views
Skip to first unread message

Kieran

unread,
Oct 1, 2011, 5:13:51 PM10/1/11
to Rabbyt
As part of my game, I have a preloader which loads behavior objects to
be passed out by reference to all entities I create. Before you ask
"why", it's because I'm generating at times, a few thousand entities
all at once and it's so much easier to have the behaviors ready and
just hand them in than create them all lazily. The behavior also
defines the movement of the entity which I'm handing it to. As you
might expect, this is a chain of lerps. Problem is, the entity
doesn't exist yet, and I have no idea where the entity might be
spawning. I essentially need a way to make the end point of a lerp be
inherently relative to the start point. From the documentation I
don't think this is possible; but the documentation hasn't always been
exactly complete, so that's one hope. The other is that someone can
point me in the direction to patch my version of rabbyt to allow
this. Worst case I can modify the preloader, but that's very icky,
and this would be a really sane way of mapping sprite paths.

Thanks guys;
-me

Matthew Marshall

unread,
Oct 2, 2011, 2:23:23 PM10/2/11
to rab...@googlegroups.com
Notice in the documentation for the rabbyt.anims module
(http://arcticpaint.com/projects/rabbyt/docs/rabbyt/anims/ ) it is
mentioned that using an arithmetic operator with an anim results in a
new anim? Add your chain anim to the starting position:

def __init__(self, motion, start_position):
super(...).__init__()
self.x = motion[0] + start_position[0]
self.y = motion[1] + start_position[1]

That should do what you want :-)

MWM

> --
> You received this message because you are subscribed to the Google Groups "Rabbyt" group.
> To post to this group, send email to rab...@googlegroups.com.
> To unsubscribe from this group, send email to rabbyt+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rabbyt?hl=en.
>
>

Kieran

unread,
Oct 2, 2011, 2:35:24 PM10/2/11
to Rabbyt
It works and I love you forever for pointing that out to me :D I have
to apologize, I misinterpreted the full functionality of what that
would offer, and looking over an old thread on here that did something
similar but not what I wanted (adding lerps); I assumed it wouldn't
offer what I needed.

Thanks much.

On Oct 2, 2:23 pm, Matthew Marshall <mwr...@gmail.com> wrote:
> Notice in the documentation for the rabbyt.anims module
> (http://arcticpaint.com/projects/rabbyt/docs/rabbyt/anims/) it is
Reply all
Reply to author
Forward
0 new messages