Transform works differently in version 7.4.0 and higher.

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
Art4D
Newbie
Posts: 9
Joined: Fri Oct 08, 2021 3:33 pm
itch: launcher
Contact:

Transform works differently in version 7.4.0 and higher.

#1 Post by Art4D » Sat Oct 09, 2021 7:13 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users