0 votes

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

Godot version v3.3.2.stable.official
in Engine by (141 points)

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

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.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.