|
|
@ -84,20 +84,19 @@ func update_generation_ui() -> void: |
|
|
|
# Conway Specific |
|
|
|
# |
|
|
|
func start_conway() -> void: |
|
|
|
generate_world() |
|
|
|
|
|
|
|
generation = 1 |
|
|
|
debug_world_seed.text = "World Seeed: %s" % world_seed |
|
|
|
debug_generation_counter.text = "Generation: %s" % generation |
|
|
|
|
|
|
|
generate_world() |
|
|
|
|
|
|
|
debug_living_cells_counter.text = "Living Cells: %s" % total_living |
|
|
|
|
|
|
|
if not is_paused: generation_timer.start() |
|
|
|
|
|
|
|
# Center the camera on the world |
|
|
|
camera.position.x = world_size.x * cell_size.x / 2 |
|
|
|
camera.position.y = world_size.y * cell_size.y / 2 |
|
|
|
|
|
|
|
if not is_paused: generation_timer.start() |
|
|
|
|
|
|
|
|
|
|
|
## Check a cell against the Conway rules and return True if cell should be alive |
|
|
|
## The logic in this could be cleaned up pretty easily. Only verbose for understanding. |
|
|
@ -211,10 +210,10 @@ func _on_quit_button_pressed() -> void: |
|
|
|
get_tree().quit() |
|
|
|
|
|
|
|
func _on_run_button_pressed() -> void: |
|
|
|
if not generation_seed.text.strip_edges(): |
|
|
|
world_seed = randi() |
|
|
|
else: |
|
|
|
if generation_seed.text.strip_edges(): |
|
|
|
world_seed = int(generation_seed.text) |
|
|
|
else: |
|
|
|
world_seed = randi() |
|
|
|
world_size = Vector2(int(generation_world_size_x.text), int(generation_world_size_y.text)) |
|
|
|
cell_size = Vector2(int(generation_cell_size_x.text), int(generation_cell_size_y.text)) |
|
|
|
|
|
|
|