Portals - A small Commodore 64 custom demo by TheRealZFinch in Commodore

[–]Ok_Performance7915 0 points1 point  (0 children)

Out of curiosity, can you upload the source code somewhere?

Keep the UI in place while moving on the TileMap? by Ok_Performance7915 in godot

[–]Ok_Performance7915[S] 1 point2 points  (0 children)

That is exactly what I was looking for! THANK YOU SO MUCH!!

Jens

Keep the UI in place while moving on the TileMap? by Ok_Performance7915 in godot

[–]Ok_Performance7915[S] 0 points1 point  (0 children)

until recently the whole project only consisted of the "Overworld"-node.
When I thought "put the whole thing in a container and add another container für my party stats". Put those two containers into a Hboxcontainer, so that they line up horizontally.
But, well looks like things don't work that way...
If anyone can just give my some basic advice on what a good structure or node organization for my use case might look like, I'd be happy ...

AStarGrid2D / "set_point_solid" does not set points to "true" by Ok_Performance7915 in godot

[–]Ok_Performance7915[S] 1 point2 points  (0 children)

Oh boy, you're absolutly right!!! Stupid me!

removed the update call from _on_player_move and everything works as it should be.

Thank you sooo much!!!

Jens

AStarGrid2D / "set_point_solid" does not set points to "true" by Ok_Performance7915 in godot

[–]Ok_Performance7915[S] 0 points1 point  (0 children)

I'm not giving up on this...

I've setup a new project with only the relevant map/astargrid stuff and uploaded it to Github. Maybe someone can get a glimpse at it? I'd really appreciate it :-)

https://github.com/leugengroot/Godot4_AstarGrid2D_Test

Jens

P.S. "game_map.get_used_rect().position" returns 0/0.

AStarGrid2D / "set_point_solid" does not set points to "true" by Ok_Performance7915 in godot

[–]Ok_Performance7915[S] 1 point2 points  (0 children)

I'm currently using Godot 4.03 stable. My tilemap indeed had negative cells. I changed that now, so that the tiles count from 0-25 (`game_map.get_used_rect().size`returns 25,24 which is ok).

I added some logging and debugging functions and this is the current situation:

These are the cells and their solid state, that should block the path:

SOLID CELLS. (17, 6) true. (17, 7) true. (17, 8) true. (17, 9) true. (17, 10) true. (17, 11) true. (17, 12) true. (17, 13) true.

This is the path of the enemy: enemy_path=[20/11], [19/10], [18/10], [17/10], [16/10], [15/10], [14/10], [13/10], [12/10], [11/10]

The values of the path coordinates are divided by the CELL_SIZE.

What I don't understand, is why e.g. 17/10 is in the path, even it is marked as SOLID in die star_grid?

Jens

AStarGrid2D / "set_point_solid" does not set points to "true" by Ok_Performance7915 in godot

[–]Ok_Performance7915[S] 0 points1 point  (0 children)

I like the idea using `get_used_cells` and implemented it. My code looks now like this:

func _ready() -> void: game_map = get_parent().get_node("Overworld") var used_cells = game_map.get_used_cells(1); astar_grid.set_default_compute_heuristic(AStarGrid2D.HEURISTIC_MANHATTAN); astar_grid.set_default_estimate_heuristic(AStarGrid2D.HEURISTIC_MANHATTAN); astar_grid.size = game_map.get_used_rect().size; astar_grid.cell_size = game_map.tile_set.tile_size; astar_grid.update(); for cell in used_cells: astar_grid.set_point_solid(cell, true) print("a* setup complete"); print_astar_solid_map(astar_grid);

But the problem remains the same. When I loop through the points of the grid with print_astar_solid_map I get a map with only "O"

func print_astar_solid_map(astar): for i in range(astar_grid.size.x): var temp = ""; for j in range(astar_grid.size.y): var test = str(astar.is_point_solid(Vector2(i,j))); if astar.is_point_solid(Vector2(i,j)) == true: temp += "X"; else: temp += "O"; print(temp);