From 02edb73602497e56b1fdab2a48ac61dc30b1bfa4 Mon Sep 17 00:00:00 2001 From: Ategon Date: Mon, 7 Oct 2024 19:06:22 -0400 Subject: [PATCH] Fix panning and spawning --- export_presets.cfg | 2 +- no_cre_build_signals.gd | 24 ++++++++++++++++++++++++ src/creature_window.gd | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/export_presets.cfg b/export_presets.cfg index befba2d..6b4f886 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -9,7 +9,7 @@ custom_features="" export_filter="all_resources" include_filter="*.txt" exclude_filter="" -export_path="builds/window-creatures.exe" +export_path="builds/Window-Creatures-WIN/window-creatures.exe" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false diff --git a/no_cre_build_signals.gd b/no_cre_build_signals.gd index 5e8e7e8..b49b37b 100644 --- a/no_cre_build_signals.gd +++ b/no_cre_build_signals.gd @@ -1,6 +1,9 @@ extends Node2D var mouse_in_window +var following +var diff = Vector2.ZERO +var last_mouse = Vector2.ZERO func _ready() -> void: Triggerer.listen("released", _on_released) @@ -20,3 +23,24 @@ func _notification(blah): if not Persister.get_value("grabbing"): get_window().grab_focus() + + +func _process(delta: float) -> void: + if Input.is_action_just_pressed("right_click") and mouse_in_window: + following = true + + if Input.is_action_just_released("right_click"): + following = false + + var mouse = get_tree().root.get_mouse_position() + if following: + diff += (mouse - last_mouse) * 4 + + var x = floor(diff.x) + var y = floor(diff.y) + + get_parent().position += Vector2i(x, y) + + diff -= Vector2(x, y) + + last_mouse = mouse diff --git a/src/creature_window.gd b/src/creature_window.gd index aa791f2..d836d0c 100644 --- a/src/creature_window.gd +++ b/src/creature_window.gd @@ -53,7 +53,7 @@ func _generate_spawn_times(): spawn_times = [] for i in range(0, Persister.get_value("creature_amount")): - spawn_times.push_back(randi_range(10, 6 * 24 - 2 - 20)) + spawn_times.push_back(randi_range(10, 6 * 17)) func _on_timer_timeout() -> void: