Merge branch 'main' of https://git.zacharie-guet.fr/zacharie/seeding-planets
This commit is contained in:
@@ -9,8 +9,12 @@ extends Node
|
||||
@export var start_state: PlantData.State = PlantData.State.MATURE
|
||||
@export var random_state := false
|
||||
@export var end_state: PlantData.State = PlantData.State.MATURE
|
||||
@export var camera_speed := 1000.0
|
||||
|
||||
var input_dir := Vector2.ZERO
|
||||
|
||||
func _ready():
|
||||
%Speed.value = camera_speed
|
||||
%ZoomLevel.value = %Camera2D.zoom.x
|
||||
%N.value = n_to_generate
|
||||
%NPerRow.value = n_per_row
|
||||
@@ -19,10 +23,11 @@ func _ready():
|
||||
%RandomizeOffset.value = random_pos_offset
|
||||
generate_plants();
|
||||
|
||||
func _input(_event) -> void:
|
||||
var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
%Camera2D.position += 1 / %Camera2D.zoom.x * 10 * input_dir
|
||||
func _unhandled_key_input(_event) -> void:
|
||||
input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
|
||||
func _process(delta):
|
||||
%Camera2D.position += 1 / %Camera2D.zoom.x * camera_speed * delta * input_dir
|
||||
|
||||
func generate_plants():
|
||||
for child in %Plants.get_children():
|
||||
@@ -111,3 +116,11 @@ func _on_random_age_toggled(toggled_on: bool) -> void:
|
||||
|
||||
func _on_end_age_value_changed(value: float) -> void:
|
||||
end_state = int(value) as PlantData.State
|
||||
|
||||
|
||||
func _on_speed_value_changed(value: float) -> void:
|
||||
camera_speed = value
|
||||
|
||||
|
||||
func _on_reset_speed_pressed() -> void:
|
||||
camera_speed = 1000
|
||||
|
||||
Reference in New Issue
Block a user