Code a Robust Grid system in Godot with these 2 Functions: Grid-based movement 3/4

preview_player
Показать описание
This is Part 3 of the Intro to Grid-based game movement, where we finish to implement the grid's core functions.
----
New tutorial every day until June 22! 11/30

Follow GDQuest on:

Рекомендации по теме
Комментарии
Автор

For anyone trying to follow this tutorial in 2022, get_pos and set_pos were changed to get_position and set_position :)

Автор

instead of nested if-statements, consider having one long boolean statement, they're logically equivalent.
if the line gets too long, it can be split by hitting \ before pressing return

NikolajLepka
Автор

I have tried the tutorial with the current stable release of Godot 3.0. However, even after changing the things I know that are different, it still doesn't work. I am getting error code "Invalid set index '2' (on base: 'int') with value of type 'int'.

starlighthaley
Автор

at 3:18 the shorthand is useless, just do "return grid[grid_pos.x][grid_pos.y] == null"

Creuilcreuil
Автор

Hello, first of all thanks for this tutorial. I have a question. I am working on a mobile game and my project window ratio is 16:9. Let's say you set grid_size = Vector2(5, 5) In order to fill all the screen with 5x5 grid i set tilemap's scale to 9/(grid_size.x). But this causes offsets on grid when player moves. How can i fix this ? I tried to change player's direction from 1 to 9/(grid_size.x) but it didn't work.

safakbulut
Автор

I may be wrong but I think you forgot to use is_cell_vacant before update_child_pos in the video

unluckymn
Автор

Is it possible to keep the array of objects in the node and use it with different tilemaps? (one for "world" which uses big sprites and camera following the player, another for "map" another for map which shows in popover on some command and displays the whole grid on screen with smaller simplified sprites)
Function world-to-map is also strange to me, isn't it makes game logic to depend from rendered picture.

nikitagoncharuk