Animation not being animated (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.
Message
Author
Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Animation not being animated (solved)

#1 Post by Ryue »

I'm using the following animation to display a fog

Code: Select all

init -1:
    image SpecialEffect001:
        animation
        LiveComposite((2732,768),
                        (1366,0),ImageReference("OverlayFrontSideOverlayDistance0TileNameOverlay001"),
                        (0,0),ImageReference("OverlayFrontSideOverlayDistance0TileNameOverlay001"))
        xpos 1366
        linear 120.0 xpos 0
        repeat  
The fog itself is displayed with renpy.show statement (and using transformations).

Code: Select all

                transformationSpecialEffectsTile = [
                    Position(xpos=int(calcedXPos - tileSideDisplayWidth),xanchor=0,yanchor=0,ypos=int(calcedYPos)), 
                    Transform(size=(specialEffectWidth, specialEffectHeight))
                ]  
Now my problem is that the fog is shown but it is not animated (in an old verison of my program I completely redid [the above code for defining the animation is the same though] it worked fine).

My question here is what I'm doing wrong.

Edit:
Here also a put together version of the show command:

Code: Select all

                if (renpy.image_exists(specialEffectName)):
                    renpy.show(
                        specialEffectName,
                        at_list             = transformationSpecialEffectsTile,
                        layer               = 'master',
                        zorder              = 200  + zOrder + 1,
                        tag                 = internSpecialEffectsName      
                    )   
The internSpecialEffectsName is "calculated" by the name of the image (specialEffectName)...in this case "SpecialEffect001" combined with the positiion on screen so
that I make sure that that name is ALWAYS unique.


linux version of a demo:
RedEyesInTheDarknessPart1-1.0-linux.tar.bz2
(19.45 MiB) Downloaded 22 times
windows versino of a demo:
RedEyesInTheDarknessPart1-1.0-win.zip
(18.04 MiB) Downloaded 31 times
Last edited by Ryue on Mon Dec 22, 2014 3:10 am, edited 2 times in total.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Animation not being animated

#2 Post by xavimat »

Man, Your demo version is obfuscated, we can't see the code.

Anyway, are you using deprecated functions: http://www.renpy.org/wiki/Animation ?
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Animation not being animated

#3 Post by Ryue »

Hi nope for defining the image i use the stated atl code. And for displaying it the renpy.show atatement with the mentioned transformation.

In total those two things are the code used to display the image and define it.

The demo is added so that it is seen what is happening (was mentioned on irc i should also put that visual demo up)

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Animation not being animated

#4 Post by xela »

Well, it's hard to solve without trying out the code.

If you just want to show a fog animation, take an animated displayable and apply a transform to it... you're over-complicating. If you want to do more than that, I can't tell what it is from a broken demo and random parts of the code :(
Like what we're doing? Support us at:
Image

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Animation not being animated

#5 Post by Ryue »

What do you mean with an animated displayable?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Animation not being animated

#6 Post by xela »

Anything that you see on the screen that's animated...

Could be Animation(*args, **properties) instance for example. Or an atl image (I don't think I've ever worked with that in this capacity).
Like what we're doing? Support us at:
Image

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Animation not being animated

#7 Post by xavimat »

Can you describe with words (I mean, without code) the effect you want to achieve? And how many fog-images do you have?
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Animation not being animated

#8 Post by xela »

For example, this is from my project (apologies if code is confusing, I do a lot of stuff with python):
*Argument is expected to be a folder containing logically named images to make up an animation, you have to add "/" because this is done automatically in the game (all of my animations are auto animated with delay provided through folder names).
**So miku_dance is a folder containing pics to an animation.

Code: Select all

init python:
    import os
    gamedir = os.path.normpath(config.gamedir)
    def animate(path, delay=0.25, transition=None):
        # Build a list of all images:
        dirs = os.listdir("".join([gamedir, path]))
        images = list("".join([path[1:], "/", fn]) for fn in dirs if fn.endswith(('.png', '.gif')))
        # Build a list of arguments
        args = list()
        for image in images:
            args.extend([image, delay, transition])
        return anim.TransitionAnimation(*args)
        
transform szoom(start_val=1.0, end_val=0.0, t=1.0):
    # Simple zoom...
    zoom start_val
    linear t zoom end_val
        
label start:
    $ var = animate("/miku_dance")
    $ renpy.show("var", what=var)
    pause
    $ renpy.show("var", what=var, at_list=[szoom(1.0, 1.5, 3)])
    pause
    $ renpy.hide("var")
    $ del var
    pause
basically you create a simple animation of fog (or anything else). Assign it to something and then show it (assigning a tag to it in the process). Then you can do whatever the hell you want to do with it and it will always stay animated. You can also do cool stuff to the variable itself, especially if it's something like a transform or can accept transform properties as arguments but examples for that are very hard to rip out of the code.

What I am trying to say is that what you've provided is not enough (for me) to understand what's going wrong because I cannot follow the logical chain of your code. So to try and help instead I am offering a logical chain that is sound, easy to work with and allows a lot of possibilities/options + it will work both in Python and Ren'Py script.
Like what we're doing? Support us at:
Image

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Animation not being animated

#9 Post by Ryue »

xavimat wrote:Can you describe with words (I mean, without code) the effect you want to achieve? And how many fog-images do you have?
The effect I want to achieve is that I see a fog "animation" on the screen that takes up a defined part of the screen and the fog itself is moving inside that defined part.
In total 3 x 5 fog images that are displayed on screen.

Would it help if I put a complete example of the built show command into the question? (as 98% of the complete code are about deciding if a mapcell should be displayed on screen its hard to decide what parts of the code are needed to be shown (as the code as a whole is too large)

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Animation not being animated

#10 Post by Ryue »

xela: is that also possible with live compositions which display a moving picture?

Also updated the question to show how the .show command looks like. Like I said its hard to figure out what is necessary as essentially the same code worked in an older program of mine and in the new one I have as good as over 1k lines which put together the display of images on the screen so its hard to filter out what is necessary to show and what not.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Animation not being animated

#11 Post by xela »

Wolf wrote:xela: is that also possible with live compositions which display a moving picture?
Yes, it should absolutely be possible. Everything in Ren'Py that you can see on the screen are Displayable and they are all very similar in how they are being displayed.
Wolf wrote:Also updated the question to show how the .show command looks like. Like I said its hard to figure out what is necessary as essentially the same code worked in an older program of mine and in the new one I have as good as over 1k lines which put together the display of images on the screen so its hard to filter out what is necessary to show and what not.
My guess is that the reason it worked before is because there was a bug in Ren'Py that new version has fixed. Best I understand your code bits is that you mess up xpos coordinates by providing yet another set and Ren'Py does not know what to so with that. I actually had a very similar thing when moving my game to 6.18 where I overwrote transform properties by supplying another set of properties and then complained that it did not work... when I sent that to PyTom, he called my code horrible and told me that it was only working due to a bug in ATL before :)

In any case... I think that you should set up a veiwport with a fixed child size, and then move your fog pictures inside of that using transforms which receive arguments (when/where to start). That would be the first thing I'd try to get the effect you describe. There are prolly other ways (maybe far better ways) to get it done, I have nothing even similar to that in my game...

PS: I am still not sure what limited the space in which fog is shown in your code :(
PS2: All the rambling above is based on assumption that what you call "animation" is an ATL that moves the object. If you were talking about an actual animation (pictures shown in succession) than there is something else at work here.
Like what we're doing? Support us at:
Image

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Animation not being animated

#12 Post by Ryue »

Will see if i can upload the old demo later today. It had the fog rolling and still works when i run it via the launcher (at least i think so if i remember correctly)

In essence the "animation" is just an endless rolling fog which does not move from the location it is displayed at but still gives the impression the fog itself is rolling/moving endlessly

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Animation not being animated

#13 Post by xela »

Wolf wrote:In essence the "animation" is just an endless rolling fog which does not move from the location it is displayed at but still gives the impression the fog itself is rolling/moving endlessly
Yes, I understand that, but is that achieved by showing a sequence of images one after another or by moving one image with atl? Based on your code, I am guessing that it's the latter, but that is an atl, not animation (in Ren'Py one would expect an animation to mean a sequence of images, at least that's how I always thought about it).

In any case, I cannot test any of it but try something like this:

Code: Select all

transform fog(start_pos=(0, 0)):
    anchor (0, 0)
    pos start_pos
    linear 120 xpos 0
    repeat

renpy.show("some_tag_you_will_use_to_hide_the_image",
                 what=LiveComposite((2732, 768),
                                             (1366,0), ImageReference("OverlayFrontSideOverlayDistance0TileNameOverlay001"),
                                             (0,0), ImageReference("OverlayFrontSideOverlayDistance0TileNameOverlay001")),
                at_list=[Transform(size=(specialEffectWidth, specialEffectHeight)), fog(start_pos=(int(calcedXPos - tileSideDisplayWidth), int(calcedYPos)))],
                **Rest_of_args)
It's derived from how I understood your code and might need some straitening out...
Like what we're doing? Support us at:
Image

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Animation not being animated

#14 Post by Ryue »

tnx.

Tried it out but somehow I'm not managing to recreate the desired effect (instead of it animating on place the tile moves around the whole screen).
animationexample.png
(8.94 KiB) Not downloaded yet
(above is a screenshot of the desired effect)

The black rectangle is representing the screen. 1366 x 768
The brown one the displayed tile ( = displayed picture). 800 x 648
The red dot is something that is discernable within the displayed tile (displayed at position 500,50).

In essence I want the picture itself to move from right to left within that brown rectangle.

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Animation not being animated

#15 Post by Ryue »

Gah i think i got that prob now :/.
It is necause innthe old version the animation filled the entire screen that it worked or am i wrong there?

Post Reply

Who is online

Users browsing this forum: No registered users