How to use a script to show an image?

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

Hello, I’m new to Godot and making games I want to make a simple 2D rock paper scissors game along with an image of either a rock, paper, or scissors (depending on what the player and the computer picked) and I’ve been wondering how to “spawn” an image on the scene during the game with a script, therefore, the player can see what the computer picked.

The answer is probably obvious but like I said I’m new to Godot.

:bust_in_silhouette: Reply From: djmick

There’s a few ways that you could do this. You could either have a sprite with the image of the rock, paper, or scissors with the visibility set to false, and then when one is picked, you set the visibility of that image to true. This would probably be easiest.
You could also make a sprite sheet where each frame is either rock, paper, or scissors, and then make an animation for each one. You would then play the animation based on whatever the choice was. I hope this helps, if not Just tell me so I ca hopefully clear it up a bit.

Thanks! I tried both but the first one is easier so I’ll just stick with that one for now.

Keby | 2021-01-26 19:07