RTS: Bulletproof algorithm

This commit is contained in:
Krzosa Karol
2023-04-19 16:16:11 +02:00
parent 2d5c2d89bc
commit 21d97a4397
3 changed files with 17 additions and 10 deletions

View File

@@ -112,7 +112,7 @@ main :: (): int
brown := BROWN
brown.a = 255/2
actor_color := GREEN
actor_color := DARKGREEN
actor_color.a = 255/2
past_actor_color := BLUE
@@ -168,8 +168,7 @@ main :: (): int
color := RAYWHITE
if *it == 1 ;; color = GRAY
if colliding == true
color = MAROON
color.a = 255/2
color = Color{a = 100}
DrawRectangleRec(r2, color)
@@ -214,7 +213,7 @@ main :: (): int
target_r := Rectangle{actor_it.target_p.x->F32 * RectX, actor_it.target_p.y->F32 * RectY, RectX, RectY}
main_p := Vector2{actor_it.p.x->F32 * RectX + RectX/2, actor_it.p.y->F32 * RectY + RectY/2}
DrawCircleV(main_p, RectX/3, actor_color)
DrawCircleV(main_p, RectX/2, actor_color)
// DrawRectangleRec(r, actor_color)
DrawRectangleRec(target_r, target_color)
@@ -222,7 +221,7 @@ main :: (): int
for tile_i := actor_it.tiles_visited.len - 1, tile_i >= 0, tile_i -= 1
tile_it := actor_it.tiles_visited.data + tile_i
p := Vector2{tile_it.x->F32 * RectX + RectX/2, tile_it.y->F32 * RectY + RectY/2}
DrawCircleV(p, RectX/3 - smaller_the_further, past_actor_color)
DrawCircleV(p, RectX/2 - smaller_the_further, past_actor_color)
smaller_the_further += 0.3
for path_i := 0, path_i < actor_it.open_paths.len, path_i += 1