Motion Trampoline Function is glitchy? [SOLVED]

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
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Motion Trampoline Function is glitchy? [SOLVED]

#1 Post 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
Last edited by sasquatchii on Tue Nov 04, 2014 11:43 pm, edited 1 time in total.
ImageImage

User avatar
TheChris
Regular
Posts: 47
Joined: Sat Oct 11, 2014 9:26 pm
Projects: Stickshooter
Deviantart: innocencecanceller
Location: United States
Contact:

Re: Motion Trampoline Function is glitchy?

#2 Post 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?

User avatar
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Re: Motion Trampoline Function is glitchy?

#3 Post 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 :)
ImageImage

User avatar
Donmai
Eileen-Class Veteran
Posts: 1962
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Motion Trampoline Function is glitchy? [SOLVED]

#4 Post 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
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Re: Motion Trampoline Function is glitchy? [SOLVED]

#5 Post 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!
ImageImage

Post Reply

Who is online

Users browsing this forum: jadeon12, mivvy