when taking a screenshot from the Camera2D, it decreases

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Timofey

it is necessary that the map looks the same as before, only without the children. So that later you can perform the combustion effect on it through the shader (so that it touches the text and I take a screenshot)

extends Control

func _physics_process(_delta):
	if Input.is_action_just_pressed('ui_accept'):
		var img := $Camera2D.get_viewport().get_texture().get_data()

    	var tex := ImageTexture.new()
    	tex.create_from_image(img)
    	$card.get_node('card').texture = tex
	
    	for child in $card.get_node('card').get_children():
    		child.queue_free()

card in editor
card tree
card after take screenshot

P.S it turns out that not only sprites can be shaded

Timofey | 2021-06-30 11:54

If you don’t want your image to appear flipped, you should call img.flip_y()

I think your problem comes from the fact that you get the entire viewport as a texture, and use that later for your sprite’s texture. So, in your “screenshot” you also have all this empty grey space.

MrEliptik | 2021-07-02 10:01