kidscancode / godot_recipes

Lessons, tutorials, and guides for game development using the Godot game engine.
MIT License
239 stars 37 forks source link

[Discussion] UI: Minimap/radar #62

Open cbscribe opened 3 years ago

cbscribe commented 3 years ago

Discussion for http://godotrecipes.com/ui/minimap/

Sousio commented 2 years ago

Thanks for sharing this extra useful tutorial. There is only a typo in the code where: if grid.get_rect().has_point(obj_pos + grid.rect_position) returns the points inside the grid's rect, but you are then hiding the markers inside, while they should be shown. So it needs a not (!) operator before condition:

if ! grid.get_rect().has_point(obj_pos + grid.rect_position):
    markers[item].hide()

or change the statement afterwards to show():

if ! grid.get_rect().has_point(obj_pos + grid.rect_position):
    markers[item].show()

However it's correct in the video version and this consistency only exist in the written version.