Diablos/Dredge like grid Inventory | Godot 4 Tutorial/Code along
Автор: MrAlphredo
Загружено: 2023-04-24
Просмотров: 29101
Описание:
I spent too much time trying to stuff an extra fish into my tiny boat in Dredge, so I decided to make my own.
Updated Info
Apologies for the confusing x,y conventions used throughout the video, to clarify:
1. The grid id of the item data (shown around 18:56) uses the convention I mentioned, which x positive goes to the right, and y positive goes to the bottom.
2. The icon_anchor used in script, used to calculate grid id in:
var calculated_grid_id = current_slot.slot_ID + icon_anchor.x * col_count + icon_anchor.y
uses the convention where x is the row, positive going down, and y is the column, positive going right.
This is why in
if can_place:
grid_array[grid_to_check].set_color(grid_array[grid_to_check].States.FREE)
#save anchor for snapping
... line 97 in inventory.gd
it may feel confusing why grid[1] sets the x component while grid[0] sets the y component. Adjusting it will require some change to the calculation, and be extra careful with the rotation logic. I am too lazy to change it but I believe my brilliant viewers will not make the same mistake again in their own projects.
github repo:
For some reason youtube description cuts off the link, I will add it in a comment.
music: lofi study by FASSounds
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: