Take screenshots in your Godot game (quick tutorial)
Вставка
- Опубліковано 31 лип 2024
- 📖 Godot 4 book: filiprachunek.gumroad.com/l/g...
💡 Get exclusive content on Patreon: / fencerdevlog
🎮 Wishlist Whispers of Prague on Steam: store.steampowered.com/app/27...
🚀 Space Shooter tutorial: • Godot 4 Tutorial: From...
🖥️ Space Shooter source code: github.com/FilipRachunek/spac...
#godot #godot4 #godotengine #godottips
Hi everybody! Would you like to know how to easily create a screenshot in your game using the Godot Engine, whether it's a 2D or 3D game? In this short video, I'll show you how.
Thank you for watching. 😎 Help support this channel:
Patreon: www.patreon.com/FencerDevLog
Gumroad: filiprachunek.gumroad.com
UA-cam Memberships: www.youtube.com/@FencerDevLog/join
If I think about it hard enough FencerDevLog will make a video about it. He is like the CGMatters of Godot Tutorials.
Bravo! ☺
Thank you! 😎
thanks you
Glad you liked it!
Great Video! i am actually using it at the moment , but i would like to set that snapshot as the texture of a Sprite2D but i am not able to do it. Do you have any advice on how to approach it ?
Thanks for watching! I suppose you can set the "texture" property of your Sprite2D node in GDScript using the "load" function to access the stored screenshot. Something like sprite2D.texture = load("user://path/to/screenshot.png"). But I never tried that myself.
Check out the second half of this video: ua-cam.com/video/D8cFSWIQWn0/v-deo.html
@@FencerDevLog thank you sir. It took me a long time but i figure out one has to transform an Image resource into ImageTexture resource before it can be used, to do so one has to use method .create_from_image().
I just put the code below for anyone who may wonder in the future
func _take_screenshot():
await RenderingServer.frame_post_draw
var viewport_texture: Image = get_viewport().get_texture().get_image()
var new_image_texture := ImageTexture.create_from_image(viewport_texture)
sprite2D.texture = new_image_texture