Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Godot Practical Tutorial Saving Run History with an Array of Dictionaries

  • GameDev with KamikaziAvalanche
  • 2025-01-16
  • 50
Godot Practical Tutorial  Saving Run History with an Array of Dictionaries
  • ok logo

Скачать Godot Practical Tutorial Saving Run History with an Array of Dictionaries бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Godot Practical Tutorial Saving Run History with an Array of Dictionaries или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Godot Practical Tutorial Saving Run History with an Array of Dictionaries бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Godot Practical Tutorial Saving Run History with an Array of Dictionaries

I wanted to share how I implemented saving and loading a player's run history using an array of dictionaries. I chose this method due to the variable length the file will have. I then extract this data to show the player their run history in a graphical manner. This practical tutorial was implemented in GDScript using Godot 4.3.

Step 1: Understand the use case
Step 2: Setup the array of dictionary format
Step 3: Program the saving functions
Step 4: Program the loading functions
Step 5: Extracting the data to display to the user

00:00 Intro
00:05 Going over the steps
01:40 Understanding the use case
02:14 Looking at the format of the data
04:09 Digging into the save code
08:46 Programing the load functions
11:19 Using the loaded data
14:42 Wrap up


Code snippets:

Step 3:

var score data = []

func load_current_save():
if FileAccess.file_exists("user://score_file.save"):
var save_file = FileAccess.open("user://score_file.save", FileAccess.READ)
var parsed_result = JSON.parse_string(save_file.get_as_text())
score_data=parsed_result
save_game()

func save_game():
var save_file = FileAccess.open("user://score_file.save", FileAccess.WRITE)
var json_string = JSON.stringify(get_save_dict())
save_file.store_line(json_string)

func get_save_dict():
var save_dict = {
"total_score" : total_score,
"won_lost" : won,
"finale_boss" : finale_boss,
"player_job" : player_job,
"player_race" : player_race,
"mission_round" : (PlayerData.persist.mission_day-1),
"date" : Time.get_date_string_from_system(false)
}
score_data.push_front(save_dict)
return score_data

Step 4:

func read_save_file():
if FileAccess.file_exists("user://score_file.save"):
pass
else:
return
var save_file = FileAccess.open("user://score_file.save", FileAccess.READ)
var parsed_result = JSON.parse_string(save_file.get_as_text())
score_data=parsed_result

Step 5:

for run in score_data:
var next_run_card = run_card.instantiate()
next_run_card.did_win=run.get("won_lost")
next_run_card.finale_faced=run.get("finale_boss")
next_run_card.class_used=run.get("player_job")
next_run_card.mission_day=run.get("mission_round")
next_run_card.total_score=run.get("total_score")
next_run_card.run_date_time=run.get("date")
next_run_card.race_used=run.get("player_race")
$PanelContainer/ScrollContainer/RunContainer.add_child(next_run_card)

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]