Core RTS :: Randomizing positions, improving visuals, info

This commit is contained in:
Krzosa Karol
2023-04-19 13:20:35 +02:00
parent 87657a99a6
commit b7385221ac
2 changed files with 51 additions and 8 deletions

View File

@@ -117,6 +117,12 @@ main :: (): int
Dt = GetFrameTime()
map := &MAP_CurrentMap
orange := ORANGE
orange.a = 255/2
brown := BROWN
brown.a = 255/2
if IsKeyPressed(KEY_F1) ;; Mode = 0
if IsKeyPressed(KEY_F2) ;; Mode = 1
@@ -124,6 +130,8 @@ main :: (): int
for i := 0, i < map.actors.len, i += 1
it := map.actors.data + i
MAP_MoveTowardsTarget(it)
if IsKeyPressed(KEY_F4)
MAP_RandomizeActors()
if IsKeyDown(KEY_SPACE)
for i := 0, i < map.actors.len, i += 1
it := map.actors.data + i
@@ -204,12 +212,12 @@ main :: (): int
for path_i := 0, path_i < actor_it.open_paths.len, path_i += 1
path_it := actor_it.open_paths.data + path_i
path_r := Rectangle{path_it.p.x->F32 * RectX, path_it.p.y->F32 * RectY, RectX, RectY}
DrawRectangleRec(path_r, ORANGE)
DrawRectangleRec(path_r, orange)
for path_i := 0, path_i < actor_it.close_paths.len, path_i += 1
path_it := actor_it.close_paths.data + path_i
path_r := Rectangle{path_it.p.x->F32 * RectX, path_it.p.y->F32 * RectY, RectX, RectY}
DrawRectangleRec(path_r, BROWN)
DrawRectangleRec(path_r, brown)
MAP_RecomputeHistory(actor_it)
for path_i := 0, path_i < actor_it.history.len, path_i += 1
@@ -230,8 +238,22 @@ main :: (): int
DrawCircleV(p1, 4, LIGHTGRAY)
if Mode == 0 ;; DrawText("F1", 0, 0, 32, BLACK)
if Mode == 1 ;; DrawText("F2", 0, 0, 32, BLACK)
text_size := 24
text_p := 4
text_y := WinY - text_size
DrawText("Space :: PathFind", text_p, text_y, text_size, GRAY)
text_y -= text_size
DrawText("F4 :: Randomize actors", text_p, text_y, text_size, GRAY)
text_y -= text_size
DrawText("F3 :: Simulate actors", text_p, text_y, text_size, GRAY)
text_y -= text_size
text: *char = "F1 :: Block placing"
if Mode == 1 ;; text = "F2 :: Actor placing"
DrawText(text, text_p, text_y, text_size, GRAY)
text_y -= text_size
EndDrawing()