Bug Report: Player Change the Color --> with a modulte >2 or 3

GodotLegendGodotLegend Posts: 2Member
edited July 13 in 2D

Ref: My player change permanently his color with a modulate > 2 or 3

English - Espanol
Hello People I would like to report this thing that I think that this is a bug
I have one Game with 4 Scenes
1 Kirby(Player)
2 WaddleDEE(My Enemy)
3. Platforms
4. Main

the think is that I conect my Enemy with Kirby I wood like a transparency efect.
After like that I put a Timer in the Kirby Scene and it must conect with him (Kirby) yes is in Kirby and conect with kirby

I put a modulate.a well when I put the transparency 0.5 or 1 is perfect but if I say = 2 or = 3 well my player has a new color half white

func _on_Kirby_Timer_timeout():
    modulate.a  =  3

NOTE: if you put modulate.a = 1 or less it will be OK

Este bug se presenta en el script de Kirby osea el player al final dice

func _on_Kirby_Timer_timeout():
    modulate.a  =  3

Si fuera 1 o menor de 1 si regresa al color natural pero de lo contrario una vez toca al enemigo blanqueado

1 Scene kirby

extends KinematicBody2D

var movement  =  Vector2(0, -1)
var up  =  Vector2(0, -1)
var gravity   =  9.8
var speed  =  150
var hurt  =  false
func _ready():

func _physics_process(delta):

    movement.y  +=  gravity
    if Input.is_action_pressed("ui_right"):
        movement.x  =  speed
        $KirbySprite.flip_h   = false     
        if is_on_floor():
    elif Input.is_action_pressed("ui_left"):
        movement.x  =  -speed
        $KirbySprite.flip_h = true
        if is_on_floor():
            $KirbyAnim.play("Walking")   # 
        movement.x  =  0
        if is_on_floor():
    if Input.is_action_just_pressed("ui_accept"):
        if is_on_floor():
            movement.y  =  -300
    if movement.y  <  0  &&  is_on_floor():
    elif movement.y  >  0  && !is_on_floor():

    movement = move_and_slide(movement, up)

func _on_WaddleDee_body_entered(body):
    modulate.a  =  0.5

func _on_Kirby_Timer_timeout():
    modulate.a  =  3

WaddleDee Scene

extends Area2D

func _ready():

func _process(delta):


  • TwistedTwiglegTwistedTwigleg Posts: 2,831Admin

    Welcome to the forums @GodotLegend!

    My guess is that you are seeing HDR rendering, since the modulate color is above 1. HDR is what makes sprites (and other stuff) glow. I'm not sure if this is a bug or not though, but I think it may be expected functionality if it is caused by the modulate color being over 1.
    That said, bugs around Godot should be reported to the Godot GitHub repository, as the forums are not really setup to be a bug tracker.

  • CalinouCalinou Posts: 451Admin Godot Developer

    This is expected. You can use Colors with components above 1 to create overbright/HDR colors.

    If you want to specify non-overbright colors with 0-255 integer values, use Color8(r, g, b[, a]) instead.

  • GodotLegendGodotLegend Posts: 2Member

    Oh Hello if you read the post I don't like to change the color I only like to do a modulate a few seconds and when I use 1 or less is perfect but if I use 2 or 3 the color will be change permanent.
    Please read my post and see the Pictures because of that I think that this is a BUG and i try to report it, and is in the rendering when I play my GAME.

    Hola la cuestion es que no deseo cambiar los colores solo deseo hacer un modulate unos pocos segundo o instantes y si se usa el modulate en 1 o menos es perfecto, vuelve al rosado, pero si se usa el modulate en 2 o 3 el cambio afect el sprite de forma permanete, por eso digo que es un BUG y se presenta es cuando juego. Denle un vistazo a las photos y lo entenderan mejor

  • MegalomaniakMegalomaniak Posts: 2,748Admin
    edited July 20

    I think the issue is that your kirby alpha remains 3 which is above 1. That is far as I can tell caused by your own code.

    In fact I'd make sure to always clamp alpha to the 0 to 1 range.

  • CalinouCalinou Posts: 451Admin Godot Developer

    @Megalomaniak As far as I know, alpha is already clamped to 0..1 in the Color class.

  • MegalomaniakMegalomaniak Posts: 2,748Admin
    edited July 23

    And yet according to the code above he is modulating only alpha and it's alpha that gets set higher than 3 1... bug?

  • TwistedTwiglegTwistedTwigleg Posts: 2,831Admin

    I did a quick look through the Color class (in the master branch) and other than the conversion code for Color, it doesn’t appear Alpha (or any of the other values) are clamped. When the Color is being used it may be clamped, but in the class itself, core/color.h and core/color.cpp, I didn’t see any clamping code when adding, subtracting, multiplying, or setting colors.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file