Page 1 of 1

Motion Trampoline Function is glitchy? [SOLVED]

Posted: Tue Nov 04, 2014 9:38 pm
by sasquatchii
I am using this motion function to animate a dog jumping up and down in my game.

However, it seems a bit glitchy, as when you click to get to the screen that the sprite is in, it flashes to the far left for a second before jumping up and down like it's supposed to. (The dog is originally a static sprite at the center of the screen, and it jumps up and down at the center of the screen like it's supposed to, but it flashing at the far left for a second is weird.) Does anyone have any ideas as to what I can do to fix this? Here is the code I'm using:

Code: Select all

init:
    python:
        import math
        def Trampoline(n):
            return (0.5, 1 - math.sin(math.pi * n), 0.5, 0)

play panting "music/laylapant.wav"
    
    show laylajump
    with moveinleft
    with vpunch
        
    n2 ""
    
    hide laylajump
    
    show screen quickmenu
    
    show casey surprised
    
    show laylajump2 at Motion(Trampoline, 3.4, repeat=True, bounce=True)
I should mention that I cut out the label start and any other code I thought was irrelevant.
Any thoughts or ideas would be much appreciated!

EDIT:
After TheChris's suggestion, I went back and changed the code to ATL, and sure enough, it worked without a hitch! Here's what I ended up using:

Code: Select all

transform move_slide:
    xalign 0.5 yalign 0.0
    linear 0.6 yalign 0.6
    linear 0.6 yalign 0.0
    repeat

Re: Motion Trampoline Function is glitchy?

Posted: Tue Nov 04, 2014 10:39 pm
by TheChris
I see what you mean. It briefly appears right in the top left hand corner for me too. Why don't you try using ATL like the top of the "motion" page suggest?

Re: Motion Trampoline Function is glitchy?

Posted: Tue Nov 04, 2014 11:44 pm
by sasquatchii
TheChris wrote:I see what you mean. It briefly appears right in the top left hand corner for me too. Why don't you try using ATL like the top of the "motion" page suggest?
Whoa, I didn't even think about ATL (total coding dummy over here, in case you couldn't tell)!

But I tried it, and it totally worked!! Thank you for suggesting it :)

Re: Motion Trampoline Function is glitchy? [SOLVED]

Posted: Wed Nov 05, 2014 7:38 am
by Donmai
sasquatchii wrote:Here's what I ended up using:

Code: Select all

transform move_slide:
    xalign 0.5 yalign 0.0
    linear 0.6 yalign 0.6
    linear 0.6 yalign 0.0
    repeat
Just a suggestion: to simulate gravity effect, try using easein and easeout.

Code: Select all

transform move_slide:
    subpixel True
    xalign 0.5 yalign 0.0
    easeout 0.6 yalign 0.6
    easein 0.6 yalign 0.0
    repeat

Re: Motion Trampoline Function is glitchy? [SOLVED]

Posted: Wed Nov 05, 2014 8:36 am
by sasquatchii
Donmai wrote:
sasquatchii wrote:Here's what I ended up using:

Code: Select all

transform move_slide:
    xalign 0.5 yalign 0.0
    linear 0.6 yalign 0.6
    linear 0.6 yalign 0.0
    repeat
Just a suggestion: to simulate gravity effect, try using easein and easeout.

Code: Select all

transform move_slide:
    subpixel True
    xalign 0.5 yalign 0.0
    easeout 0.6 yalign 0.6
    easein 0.6 yalign 0.0
    repeat
Thank you for this, I put this into the code and am so thrilled with the results :) This is such a small detail but really makes a HUGE difference!