Intermedio

Godot. Create a recollectable item

Submitted by tech4life on

To make our games more playable, it is sometimes interesting to add items or objects that the player can pick up to increase their skills in the game.

In this mini tutorial we are going to give you the keys to create an item that our player, in our case a ship, can pick up and increase one of its skills. In this case it will be a shield and we will teach you how to pick up the item and activate the shield.

The first step is to create the scene that corresponds to our item.

Godot. Open a file

Submitted by tech4life on

In our games, it is sometimes essential to have resource files with data.

In this pill we are going to see how to open a file and read the data inside.

In our case the all_words.txt file is in the assets folder and is a list of words separated by commas.

To read it we first have to open the file indicating that we only want to read the data.

file = FileAccess.open("res://assets/all_words.txt", FileAccess.READ)

The next step is to convert the file to text with the get_as_text function