From beb2b936133e136de07b11c41f01a3f619f64f28 Mon Sep 17 00:00:00 2001 From: patrick_pluto Date: Fri, 2 Aug 2024 00:55:56 +0200 Subject: [PATCH] Initial Commit --- .gitattributes | 2 + .gitignore | 2 + export_presets.cfg | 205 ++++++++++++++++++++++++++++++++++++++++++ maps/base_map.tscn | 29 ++++++ objects/computer.tscn | 72 +++++++++++++++ objects/player.tscn | 22 +++++ project.godot | 67 ++++++++++++++ scripts/computer.gd | 58 ++++++++++++ scripts/game.gd | 6 ++ scripts/movement.gd | 53 +++++++++++ 10 files changed, 516 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 export_presets.cfg create mode 100644 maps/base_map.tscn create mode 100644 objects/computer.tscn create mode 100644 objects/player.tscn create mode 100644 project.godot create mode 100644 scripts/computer.gd create mode 100644 scripts/game.gd create mode 100644 scripts/movement.gd diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4709183 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Godot 4+ specific ignores +.godot/ diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..c26707d --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,205 @@ +[preset.0] + +name="Windows Desktop" +platform="Windows Desktop" +runnable=true +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../Desktop/64.exe" +encryption_include_filters="" +encryption_exclude_filters="" +encrypt_pck=false +encrypt_directory=false + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=1 +binary_format/embed_pck=true +texture_format/bptc=true +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +binary_format/architecture="x86_64" +codesign/enable=false +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PackedStringArray() +application/modify_resources=true +application/icon="" +application/console_wrapper_icon="" +application/icon_interpolation=4 +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" +application/export_angle=0 +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}' +$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}' +$trigger = New-ScheduledTaskTrigger -Once -At 00:00 +$settings = New-ScheduledTaskSettingsSet +$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings +Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true +Start-ScheduledTask -TaskName godot_remote_debug +while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 } +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue" +ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue +Remove-Item -Recurse -Force '{temp_dir}'" + +[preset.1] + +name="Windows Desktop 2" +platform="Windows Desktop" +runnable=false +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../Desktop/32.exe" +encryption_include_filters="" +encryption_exclude_filters="" +encrypt_pck=false +encrypt_directory=false + +[preset.1.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=1 +binary_format/embed_pck=true +texture_format/bptc=true +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +binary_format/architecture="x86_32" +codesign/enable=false +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PackedStringArray() +application/modify_resources=true +application/icon="" +application/console_wrapper_icon="" +application/icon_interpolation=4 +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" +application/export_angle=0 +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}' +$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}' +$trigger = New-ScheduledTaskTrigger -Once -At 00:00 +$settings = New-ScheduledTaskSettingsSet +$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings +Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true +Start-ScheduledTask -TaskName godot_remote_debug +while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 } +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue" +ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue +Remove-Item -Recurse -Force '{temp_dir}'" + +[preset.2] + +name="Linux/X11" +platform="Linux/X11" +runnable=true +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../Desktop/linux.x86_64" +encryption_include_filters="" +encryption_exclude_filters="" +encrypt_pck=false +encrypt_directory=false + +[preset.2.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=1 +binary_format/embed_pck=true +texture_format/bptc=true +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +binary_format/architecture="x86_64" +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="#!/usr/bin/env bash +export DISPLAY=:0 +unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\" +\"{temp_dir}/{exe_name}\" {cmd_args}" +ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash +kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\") +rm -rf \"{temp_dir}\"" + +[preset.3] + +name="Linux/X11 2" +platform="Linux/X11" +runnable=false +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../Desktop/linux.x86_32" +encryption_include_filters="" +encryption_exclude_filters="" +encrypt_pck=false +encrypt_directory=false + +[preset.3.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=1 +binary_format/embed_pck=true +texture_format/bptc=true +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +binary_format/architecture="x86_32" +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="#!/usr/bin/env bash +export DISPLAY=:0 +unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\" +\"{temp_dir}/{exe_name}\" {cmd_args}" +ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash +kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\") +rm -rf \"{temp_dir}\"" diff --git a/maps/base_map.tscn b/maps/base_map.tscn new file mode 100644 index 0000000..f5c212d --- /dev/null +++ b/maps/base_map.tscn @@ -0,0 +1,29 @@ +[gd_scene load_steps=4 format=3 uid="uid://2qsccmko8yl8"] + +[ext_resource type="PackedScene" uid="uid://b440i2oidk5sp" path="res://objects/player.tscn" id="1_e1efq"] +[ext_resource type="PackedScene" uid="uid://4mhcwvn365ki" path="res://objects/computer.tscn" id="2_28qhl"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_34oyu"] +size = Vector3(50, 1, 50) + +[node name="Node3D" type="Node3D"] + +[node name="StaticBody3D" type="StaticBody3D" parent="."] + +[node name="CSGBox3D" type="CSGBox3D" parent="StaticBody3D"] +size = Vector3(50, 1, 50) + +[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"] +shape = SubResource("BoxShape3D_34oyu") + +[node name="player" parent="." instance=ExtResource("1_e1efq")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.32619, 2.43562, 13.4822) + +[node name="light" type="DirectionalLight3D" parent="."] +transform = Transform3D(0.545371, 0.353189, 0.76015, 0, -0.90689, 0.421368, 0.838195, -0.229802, -0.494591, 0, 10.2747, 0) + +[node name="computers" parent="." instance=ExtResource("2_28qhl")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 1, 3) + +[node name="computers2" parent="." instance=ExtResource("2_28qhl")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 3) diff --git a/objects/computer.tscn b/objects/computer.tscn new file mode 100644 index 0000000..983528e --- /dev/null +++ b/objects/computer.tscn @@ -0,0 +1,72 @@ +[gd_scene load_steps=4 format=3 uid="uid://4mhcwvn365ki"] + +[ext_resource type="Script" path="res://scripts/computer.gd" id="1_bnoot"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_bvobj"] +size = Vector3(2, 1.75, 1.5) + +[sub_resource type="BoxShape3D" id="BoxShape3D_nfndi"] + +[node name="computers" type="StaticBody3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) +script = ExtResource("1_bnoot") + +[node name="collision" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.375, 0) +shape = SubResource("BoxShape3D_bvobj") + +[node name="desk" type="CSGBox3D" parent="."] +size = Vector3(2, 1, 1.5) + +[node name="pc_1" type="CSGBox3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.875, 0.5) +size = Vector3(1, 0.75, 0.25) + +[node name="pc_1_area" type="Area3D" parent="pc_1"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="pc_1/pc_1_area"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.75, 0.875) +shape = SubResource("BoxShape3D_nfndi") + +[node name="Label3D" type="Label3D" parent="pc_1"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.13) +text = "0" + +[node name="pc_2" type="CSGBox3D" parent="."] +transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0.75, 0.875, 0) +size = Vector3(1, 0.75, 0.25) + +[node name="pc_2_area" type="Area3D" parent="pc_2"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="pc_2/pc_2_area"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.75, 0.875) +shape = SubResource("BoxShape3D_nfndi") + +[node name="Label3D" type="Label3D" parent="pc_2"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.13) +text = "0" + +[node name="pc_3" type="CSGBox3D" parent="."] +transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -0.75, 0.875, 0) +size = Vector3(1, 0.75, 0.25) + +[node name="pc_3_area" type="Area3D" parent="pc_3"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="pc_3/pc_3_area"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.75, 0.875) +shape = SubResource("BoxShape3D_nfndi") + +[node name="Label3D" type="Label3D" parent="pc_3"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.55271e-15, 0, 0.13) +text = "0" + +[node name="computer_tick" type="Timer" parent="."] +autostart = true + +[connection signal="body_entered" from="pc_1/pc_1_area" to="." method="_on_pc_1_area_body_entered"] +[connection signal="body_exited" from="pc_1/pc_1_area" to="." method="_on_pc_1_area_body_exited"] +[connection signal="body_entered" from="pc_2/pc_2_area" to="." method="_on_pc_2_area_body_entered"] +[connection signal="body_exited" from="pc_2/pc_2_area" to="." method="_on_pc_2_area_body_exited"] +[connection signal="body_entered" from="pc_3/pc_3_area" to="." method="_on_pc_3_area_body_entered"] +[connection signal="body_exited" from="pc_3/pc_3_area" to="." method="_on_pc_3_area_body_exited"] +[connection signal="timeout" from="computer_tick" to="." method="_on_computer_tick_timeout"] diff --git a/objects/player.tscn b/objects/player.tscn new file mode 100644 index 0000000..789ff66 --- /dev/null +++ b/objects/player.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=3 uid="uid://b440i2oidk5sp"] + +[ext_resource type="Script" path="res://scripts/movement.gd" id="1_uru11"] + +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_2l8cp"] + +[sub_resource type="CapsuleMesh" id="CapsuleMesh_fhldf"] + +[node name="player" type="CharacterBody3D"] +script = ExtResource("1_uru11") + +[node name="collision" type="CollisionShape3D" parent="."] +shape = SubResource("CapsuleShape3D_2l8cp") + +[node name="bean" type="MeshInstance3D" parent="."] +mesh = SubResource("CapsuleMesh_fhldf") + +[node name="cam_y" type="Node3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 0, 0) + +[node name="Camera3D" type="Camera3D" parent="cam_y"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 8) diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..11bd540 --- /dev/null +++ b/project.godot @@ -0,0 +1,67 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="OpenFlee" +run/main_scene="res://maps/base_map.tscn" +config/features=PackedStringArray("4.2", "Forward Plus") + +[autoload] + +Game="*res://scripts/game.gd" + +[input] + +forwards={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null) +] +} +backwards={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null) +] +} +left={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null) +] +} +right={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null) +] +} +cam_look={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"canceled":false,"pressed":false,"double_click":false,"script":null) +] +} +jump={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null) +] +} +zoom_in={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null) +] +} +zoom_out={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"canceled":false,"pressed":false,"double_click":false,"script":null) +] +} + +[rendering] + +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" diff --git a/scripts/computer.gd b/scripts/computer.gd new file mode 100644 index 0000000..1b20a86 --- /dev/null +++ b/scripts/computer.gd @@ -0,0 +1,58 @@ +extends StaticBody3D + +const TARGET = 100 +var current = 0 + +var pc_occupied = [0, 0, 0,] + +var pc_body = [0, 0, 0] + +func _ready(): + Game.computers += 1 + +func _on_computer_tick_timeout(): + current += (pc_occupied[0] + pc_occupied[1] + pc_occupied[2]) + if current >= TARGET: + current = "Complete" + $computer_tick.stop() + Game.computers -= 1 + $pc_1/Label3D.text = str(current) + $pc_2/Label3D.text = str(current) + $pc_3/Label3D.text = str(current) + + +func _on_pc_1_area_body_entered(body): + if pc_occupied[0] == 0: + body.has_method("_input") + pc_occupied[0] = 1 + pc_body[0] = body + + +func _on_pc_2_area_body_entered(body): + if pc_occupied[1] == 0: + pc_occupied[1] = 1 + pc_body[1] = body + + +func _on_pc_3_area_body_entered(body): + if pc_occupied[2] == 0: + pc_occupied[2] = 1 + pc_body[2] = body + + +func _on_pc_1_area_body_exited(body): + if pc_occupied[0] == 1 and body == pc_body[0]: + pc_occupied[0] = 0 + pc_body[0] = 0 + + +func _on_pc_2_area_body_exited(body): + if pc_occupied[1] == 1 and body == pc_body[1]: + pc_occupied[1] = 0 + pc_body[1] = 0 + + +func _on_pc_3_area_body_exited(body): + if pc_occupied[2] == 1 and body == pc_body[2]: + pc_occupied[2] = 0 + pc_body[2] = 0 diff --git a/scripts/game.gd b/scripts/game.gd new file mode 100644 index 0000000..19c87b7 --- /dev/null +++ b/scripts/game.gd @@ -0,0 +1,6 @@ +extends Node + +var computers = 0 + +func _process(delta): + print(computers) diff --git a/scripts/movement.gd b/scripts/movement.gd new file mode 100644 index 0000000..5b9aaa9 --- /dev/null +++ b/scripts/movement.gd @@ -0,0 +1,53 @@ +extends CharacterBody3D + + +const SPEED = 5.0 +const JUMP_VELOCITY = 4.5 +var zoom = 0 + + +var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") + + +func _physics_process(delta): + + if not is_on_floor(): + velocity.y -= gravity * delta + + + if Input.is_action_just_pressed("jump") and is_on_floor(): + velocity.y = JUMP_VELOCITY + + var input_dir = Input.get_vector("left", "right", "forwards", "backwards") + var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() + if direction: + velocity.x = direction.x * SPEED + velocity.z = direction.z * SPEED + else: + velocity.x = move_toward(velocity.x, 0, SPEED) + velocity.z = move_toward(velocity.z, 0, SPEED) + + move_and_slide() + +func _input(event): + if event is InputEventMouseMotion and (Input.is_action_pressed("cam_look") or $cam_y/Camera3D.position.z == 0): + var camera_rotation = event.relative * 0.01 + if $cam_y.rotation.x <= 1.6 && camera_rotation.y <= 0: + $cam_y.rotate(Vector3.RIGHT, -camera_rotation.y) + elif $cam_y.rotation.x >= -1.6 && camera_rotation.y >= 0: + $cam_y.rotate(Vector3.RIGHT, -camera_rotation.y) + if $cam_y.rotation.x >= 1.6: + $cam_y.rotation.x = 1.6 + elif $cam_y.rotation.x <= -1.6: + $cam_y.rotation.x = -1.6 + rotate(Vector3.DOWN, camera_rotation.x) + +func _unhandled_input(event): + if event.is_action_pressed("zoom_in") && $cam_y/Camera3D.position.z > 0: + zoom = -1 + $cam_y/Camera3D.position.z += zoom + elif event.is_action_pressed("zoom_out") && $cam_y/Camera3D.position.z <= 20: + zoom = 1 + $cam_y/Camera3D.position.z += zoom + else: + zoom = 0