Page 1 of 1

Transform works differently in version 7.4.0 and higher.

Posted: Sat Oct 09, 2021 7:13 pm
by Art4D
Hi, I have a code that added particles of different colors and sizes to the screen via SnowBlossom.

In 7.3.5 it works fine:
Image

In 7.4.0 and higher, the color and size are assigned once, and not a new particle - a new color and size:
Image
Is this a mistake?
If not, how do I make a code that will work on 7.4.9 as well as the current one for 7.3.5

Code: Select all

init python:
    def WeightedChoice(choices):
        """
        @param choices: A list of (choice, weight) tuples. Returns a random
        choice (using renpy.random as the random number generator)
        """
        totalweight = 0.0
        for choice, weight in choices:
            totalweight += weight
        randval = renpy.random.random() * totalweight
        for choice, weight in choices:
            if randval <= weight:
                return choice
            else:
                randval -= weight
    
init:  
    transform blink(r0,r255,g0,g255,b0,b255):
        zoom WeightedChoice([(0.15, 0.40), (0.18, 0.3), (0.23, 0.2), (renpy.random.random()+renpy.random.randint(0, 2), 0.05)])  
        im.Recolor("gui/window_icon.png", WeightedChoice([(r0, 0.20), (r0+1*(r255-r0)/4, 0.3), (r0+2*(r255-r0)/4, 0.3), (r0+3*(r255-r0)/4, 0.3), (r255, 0.2)]), WeightedChoice([(g0, 0.20), (g0+1*(g255-g0)/4, 0.3), (g0+2*(g255-g0)/4, 0.3), (g0+3*(g255-g0)/4, 0.3), (g255, 0.2)]), WeightedChoice([(b0, 0.20), (b0+1*(b255-b0)/4, 0.3), (b0+2*(b255-b0)/4, 0.3), (b0+3*(b255-b0)/4, 0.3), (b255, 0.2)]))    
        linear 1.0 alpha 1.0
        pause 2
        linear 1.0 alpha 0.0
        pause 1      
        repeat
        
     
image embers = SnowBlossom(blink(0,255,0,255,0,255), border=50, count=400, start=0.1, fast=False, yspeed=(-60, -30), xspeed=(-120, 80), horizontal=True)

label start:
    show embers zorder 1
    pause
    return    
You can reproduce this on your computer, create a new project and put the code in script.rpy.