Godot version of Conway's game of life
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

30 lines
793 B

extends Node2D
@export var zoom_increment: Vector2 = Vector2(0.1, 0.1)
@export var move_speed: int = 250
var mouse: Vector2 = Vector2.ZERO
@onready var camera: Camera2D = $Camera2D
func _process(delta: float) -> void:
var input_dir := Input.get_vector("Left", "Right", "Up", "Down")
var velocity_y = input_dir.y * move_speed * delta
var velocity_x = input_dir.x * move_speed * delta
position += Vector2(velocity_x, velocity_y)
mouse = Vector2()
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("Zoom In"):
camera.zoom += zoom_increment
if event.is_action_pressed("Zoom Out"):
camera.zoom -= zoom_increment
if event.is_action_pressed("Reset Zoom"):
camera.zoom = Vector2.ONE
func update_position(pos: Vector2) -> void:
camera.position = pos