Browse Source

Centering camera on world based on world size

pull/1/head
Ryan Reed 1 year ago
parent
commit
f3126f4a2d
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      world.gd

+ 6
- 0
world.gd View File

@ -11,6 +11,8 @@ enum CellStates {
ALIVE,
}
@onready var camera: Camera2D = $Camera2D
@onready var generation_counter: Label = $CanvasLayer/Debug/VBoxContainer/GenerationCounter
@onready var generation_timer: Timer = $GenerationTimer
@onready var living_cells_counter: Label = $CanvasLayer/Debug/VBoxContainer/LivingCellsCounter
@ -35,6 +37,10 @@ func _ready() -> void:
generate_world()
# Center the camea on the world
camera.position.x = world_size.x * cell_size.x / 2
camera.position.y = world_size.y * cell_size.y / 2
## Check a cell against the Conway rules and return True if cell shoudl be alive
func cell_is_alive(pos: Vector2) -> bool:


Loading…
Cancel
Save