atl infinite loop exception question.

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
visual00
Regular
Posts: 28
Joined: Fri Aug 22, 2014 8:28 am
IRC Nick: TaeIn
Contact:

atl infinite loop exception question.

#1 Post by visual00 »

hi guys!
I will ask you a question but
I can't speak english very well. I'm sorry
You understanding please




I made the jump animation

however generic code exception occurs

How do I resolve???

i attached code and project

i hope help

Code: Select all

image pini smile = "pini_smile.png"
image pini normal = "pini_normal.png"
image bg = im.Scale("classroom1.png", 1280, 720)

define pini = Character('Pini', color="#c8ffc8")

# jump move animation
transform at_jump(x, y, count, height, sec):
    parallel:
        linear sec xcenter x
    parallel:
        linear sec ycenter y
    parallel:
        linear sec/count/2 yoffset -(height)
        linear sec/count/2 yoffset 0
        repeat count

label start:
    
    scene bg
    
    show pini normal:
        xcenter 300 ycenter 430
    
    pini "jumping jumping everybody"
    
    show pini smile at at_jump(x=1000, y=430, count=3, height=100, sec=1)
    
    pini "this is jump move"
    
    return
Attachments
jump move example.zip
(3.86 MiB) Downloaded 30 times

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: atl infinite loop exception question.

#2 Post by PyTom »

So, the problem here is that since we're using python 2, an integer divided by an integer is an integer, rounded down. So when sec=1 and count=3, we get:

1 / 3 / 2 = 0

If you make sec=1.0, we get:

1.0 / 3 / 2 = 0.16666...

which is what you want. So write:

Code: Select all

    show pini smile at at_jump(x=1000, y=430, count=3, height=100, sec=1.0)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
visual00
Regular
Posts: 28
Joined: Fri Aug 22, 2014 8:28 am
IRC Nick: TaeIn
Contact:

Re: atl infinite loop exception question.

#3 Post by visual00 »

PyTom wrote:So, the problem here is that since we're using python 2, an integer divided by an integer is an integer, rounded down. So when sec=1 and count=3, we get:

1 / 3 / 2 = 0

If you make sec=1.0, we get:

1.0 / 3 / 2 = 0.16666...

which is what you want. So write:

Code: Select all

    show pini smile at at_jump(x=1000, y=430, count=3, height=100, sec=1.0)
Thanks to. pytom

my problem has been resolved

Thank you very much

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], VirtualPassion