Compare commits

...

2 commits

Author SHA1 Message Date
Ategon
8d13b0deac Fix shop crash 2024-10-07 19:26:50 -04:00
Ategon
02edb73602 Fix panning and spawning 2024-10-07 19:06:22 -04:00
4 changed files with 27 additions and 2 deletions

View file

@ -9,7 +9,7 @@ custom_features=""
export_filter="all_resources" export_filter="all_resources"
include_filter="*.txt" include_filter="*.txt"
exclude_filter="" exclude_filter=""
export_path="builds/window-creatures.exe" export_path="builds/Window-Creatures-WIN/window-creatures.exe"
encryption_include_filters="" encryption_include_filters=""
encryption_exclude_filters="" encryption_exclude_filters=""
encrypt_pck=false encrypt_pck=false

View file

@ -1,6 +1,9 @@
extends Node2D extends Node2D
var mouse_in_window var mouse_in_window
var following
var diff = Vector2.ZERO
var last_mouse = Vector2.ZERO
func _ready() -> void: func _ready() -> void:
Triggerer.listen("released", _on_released) Triggerer.listen("released", _on_released)
@ -20,3 +23,24 @@ func _notification(blah):
if not Persister.get_value("grabbing"): if not Persister.get_value("grabbing"):
get_window().grab_focus() 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

View file

@ -53,7 +53,7 @@ func _generate_spawn_times():
spawn_times = [] spawn_times = []
for i in range(0, Persister.get_value("creature_amount")): 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: func _on_timer_timeout() -> void:

View file

@ -20,6 +20,7 @@ func _ready() -> void:
func _on_window_close_icon(_data): func _on_window_close_icon(_data):
if key == "upgrade_menu": if key == "upgrade_menu":
sprite_2d.texture = image sprite_2d.texture = image
Persister.persist_data(key, false)
func _on_mouse_handler_clicked() -> void: func _on_mouse_handler_clicked() -> void:
if value == "toggle": if value == "toggle":