small racing game im working on
-rw-r--r--godot.lock5
-rw-r--r--godot.package1
-rw-r--r--project.godot27
-rw-r--r--ui/editor/cam.gd11
-rw-r--r--ui/editor/hatch.gd8
-rw-r--r--ui/editor/help.gd10
-rw-r--r--ui/editor/help.tscn144
-rw-r--r--ui/editor/track_editor.tscn32
8 files changed, 203 insertions, 35 deletions
diff --git a/godot.lock b/godot.lock
index bb90ee5..b0a14ab 100644
--- a/godot.lock
+++ b/godot.lock
@@ -10,6 +10,11 @@
"version": "1.0.4"
},
{
+ "name": "@bendn/remap",
+ "tarball": "https://registry.npmjs.org/@bendn/remap/-/remap-5.1.0.tgz",
+ "version": "5.1.0"
+ },
+ {
"name": "@bendn/splitter",
"tarball": "https://registry.npmjs.org/@bendn/splitter/-/splitter-1.1.0.tgz",
"version": "1.1.0"
diff --git a/godot.package b/godot.package
index b89b419..2ce58bd 100644
--- a/godot.package
+++ b/godot.package
@@ -3,4 +3,5 @@ packages: {
@bendn/splitter: '1.1.0'
@bendn/enginesound: '1.0.0'
@bendn/timecontrol: '1.2.2'
+ @bendn/remap: '5.1.0'
}
diff --git a/project.godot b/project.godot
index bce33e3..e53ee1d 100644
--- a/project.godot
+++ b/project.godot
@@ -132,14 +132,14 @@ reset={
]
}
left={
-"deadzone": 0.1,
+"deadzone": 0.05,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"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":0,"echo":false,"script":null)
]
}
right={
-"deadzone": 0.1,
+"deadzone": 0.05,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"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":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
@@ -155,14 +155,29 @@ ui_pan={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":3,"pressed":false,"double_click":false,"script":null)
]
}
-rotate_cw={
+change_depth+={
+"deadzone": 0.5,
+"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"button_mask":8,"position":Vector2(173, 6),"global_position":Vector2(177, 49),"factor":1.0,"button_index":4,"pressed":true,"double_click":false,"script":null)
+]
+}
+change_depth-={
+"deadzone": 0.5,
+"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"pressed":false,"double_click":false,"script":null)
+]
+}
+freelook={
+"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":2,"position":Vector2(104, 2),"global_position":Vector2(108, 45),"factor":1.0,"button_index":2,"pressed":true,"double_click":false,"script":null)
+]
+}
+zoom_in={
"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":82,"key_label":0,"unicode":114,"echo":false,"script":null)
+"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":8,"position":Vector2(140, 14),"global_position":Vector2(144, 57),"factor":1.0,"button_index":4,"pressed":true,"double_click":false,"script":null)
]
}
-rotate_ccw={
+zoom_out={
"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":82,"echo":false,"script":null)
+"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":16,"position":Vector2(165, 16),"global_position":Vector2(169, 59),"factor":1.0,"button_index":5,"pressed":true,"double_click":false,"script":null)
]
}
diff --git a/ui/editor/cam.gd b/ui/editor/cam.gd
index 88c9ba8..30e5ba7 100644
--- a/ui/editor/cam.gd
+++ b/ui/editor/cam.gd
@@ -14,7 +14,7 @@ var m_vel := Vector2.ZERO
func _process(_delta):
m_vel = get_viewport().get_mouse_position() - last_m_pos
last_m_pos = get_viewport().get_mouse_position()
- if Input.is_mouse_button_pressed(MOUSE_BUTTON_RIGHT):
+ if Input.is_action_pressed(&"freelook"):
if Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED:
mp_before_freelook = get_viewport().get_mouse_position()
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED);
@@ -35,11 +35,10 @@ func _input(event: InputEvent):
if freelook and event is InputEventMouseMotion:
rotation.x = clamp(rotation.x + (-event.relative.y * MOUSE_SENSITIVTY), -CAMERA_MAX_ROTATION_ANGLE, CAMERA_MAX_ROTATION_ANGLE);
rotation.y += -event.relative.x * MOUSE_SENSITIVTY;
- elif event is InputEventMouseButton:
- match event.button_index:
- # camera zoom
- MOUSE_BUTTON_WHEEL_UP: global_position -= global_transform.basis.z * SCROLL_SENS
- MOUSE_BUTTON_WHEEL_DOWN: global_position += global_transform.basis.z * SCROLL_SENS
+ elif event.is_action(&"zoom_in"):
+ global_position -= global_transform.basis.z * SCROLL_SENS
+ elif event.is_action(&"zoom_out"):
+ global_position += global_transform.basis.z * SCROLL_SENS
elif event is InputEventMouseMotion and panning:
var v := get_viewport()
var mp := v.get_mouse_position()
diff --git a/ui/editor/hatch.gd b/ui/editor/hatch.gd
index f52789d..ccd4cb8 100644
--- a/ui/editor/hatch.gd
+++ b/ui/editor/hatch.gd
@@ -6,10 +6,6 @@ signal created(object: TrackObject)
signal remove_tobj(tobj: TrackObject)
signal depth_changed(depth: float)
-@export var shift_scrollup: Shortcut
-@export var shift_scrolldown: Shortcut
-
-
var input_ms: int = 0
var depth: float = 50.0:
set(d):
@@ -71,5 +67,5 @@ func _gui_input(event: InputEvent) -> void:
depth = max(25, depth + i)
input_ms = Time.get_ticks_msec()
get_viewport().set_input_as_handled()
- if shift_scrolldown.matches_event(event): change.call(-Globals.SNAP.y)
- elif shift_scrollup.matches_event(event): change.call(Globals.SNAP.y)
+ if event.is_action(&"change_depth+"): change.call(-Globals.SNAP.y)
+ elif event.is_action(&"change_depth+"): change.call(Globals.SNAP.y)
diff --git a/ui/editor/help.gd b/ui/editor/help.gd
new file mode 100644
index 0000000..3e13ed5
--- /dev/null
+++ b/ui/editor/help.gd
@@ -0,0 +1,10 @@
+extends Button
+
+@export var help_scn: PackedScene
+var help: Window
+
+func _pressed() -> void:
+ if not is_instance_valid(help):
+ help = help_scn.instantiate()
+ help.close_requested.connect(help.queue_free)
+ add_child(help)
diff --git a/ui/editor/help.tscn b/ui/editor/help.tscn
new file mode 100644
index 0000000..166bc33
--- /dev/null
+++ b/ui/editor/help.tscn
@@ -0,0 +1,144 @@
+[gd_scene load_steps=7 format=3 uid="uid://dby5rfnqh7bw8"]
+
+[ext_resource type="StyleBox" uid="uid://dxtsrhgnyr80k" path="res://ui/panel_dark.stylebox" id="1_wnpue"]
+[ext_resource type="Theme" uid="uid://d3ywcokn5ddy8" path="res://ui/theme.tres" id="2_6tbpq"]
+[ext_resource type="Script" path="res://addons/@bendn/remap/ActionLabel.gd" id="2_ye7r6"]
+
+[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_qrm46"]
+content_margin_right = 5.0
+
+[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cixwx"]
+content_margin_left = 5.0
+content_margin_top = 5.0
+content_margin_right = 5.0
+content_margin_bottom = 5.0
+bg_color = Color(0.027451, 0.211765, 0.258824, 1)
+corner_radius_top_left = 15
+corner_radius_top_right = 15
+corner_radius_bottom_right = 15
+corner_radius_bottom_left = 15
+corner_detail = 12
+
+[sub_resource type="Theme" id="Theme_v23rf"]
+PanelContainer/styles/panel = SubResource("StyleBoxFlat_cixwx")
+
+[node name="help" type="Window"]
+title = "how to editor"
+position = Vector2i(0, 36)
+size = Vector2i(1024, 512)
+wrap_controls = true
+transient = true
+min_size = Vector2i(512, 256)
+theme = ExtResource("2_6tbpq")
+
+[node name="panel" type="PanelContainer" parent="."]
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme_override_styles/panel = ExtResource("1_wnpue")
+
+[node name="inputs" type="ScrollContainer" parent="panel"]
+layout_mode = 2
+theme_override_styles/panel = SubResource("StyleBoxEmpty_qrm46")
+
+[node name="vbox" type="VBoxContainer" parent="panel/inputs"]
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="tut" type="RichTextLabel" parent="panel/inputs/vbox"]
+custom_minimum_size = Vector2(0, 200)
+layout_mode = 2
+theme_override_colors/default_color = Color(0.933333, 0.909804, 0.835294, 1)
+theme_override_font_sizes/normal_font_size = 25
+theme_override_font_sizes/bold_font_size = 30
+theme_override_font_sizes/italics_font_size = 15
+bbcode_enabled = true
+text = "[center][b]camera controls[/b][/center]
+Zooming in and out [i](with default keybinds)[/i] is done with the scroll wheel. You can pan the camera with shift + middle mouse.
+
+[center][b]block placing[/b][/center]
+To place a block, go into the filesystem panel (left), open a folder, and drag a block in.
+
+[center][b]block transformation[/b][/center]
+The toolbar on the topleft is used for various block manipulation.
+The default mode is selection (󰇀), which lets you select blocks. After selecting a block, try switching to the transform gizmo (󰆾 ).
+A object will appear with arrows sticking out of a cube. Interacting with the arrows will move the object that is selected.
+Its worth noting that you can also select multiple objects by dragging, and all the gizmos will work.
+The scale gizmo (󰘖 ) is the same, but for scaling.
+The rotation gizmo (󰶘 ) is a little different. You see, rotation gizmos are quite difficult, so this rotation gizmo operates on keybinds, even though it has a visual hull. R rotates clockwise, and shift + R rotates counter clockwise.
+
+[center][b]barrier creation[/b][/center]
+
+When selecting blocks, the panel on the right (which is called the inspector) may show a walls (󰟾 ) panel.
+Selecting different boxes on the panel will then create barriers.
+[i]todo: make this easier to work with.[/i]
+
+[center][b]block painting[/b][/center]
+You may have noticed some things in the filesystem panel arent directly draggable into the track.
+They are materials. You can drag them onto the paintbrush button on the toolbar, then pressing the paintbrush button will turn your cursor into a brush. Clicking a block will paint that block with the material selected.
+
+[center][b]track settings[/b][/center]
+Theres a few settings for your track:
+[ul]
+Track name: determines track name, and save location
+Laps: number of times you have to pass the finish
+Time: determines the location of the sun
+[/ul]
+
+[center][b]keybinds[/b][/center]"
+fit_content = true
+
+[node name="inputs" type="VBoxContainer" parent="panel/inputs/vbox"]
+layout_mode = 2
+size_flags_horizontal = 3
+theme = SubResource("Theme_v23rf")
+
+[node name="pan" type="HBoxContainer" parent="panel/inputs/vbox/inputs"]
+layout_mode = 2
+tooltip_text = "Pans the camera"
+script = ExtResource("2_ye7r6")
+_name = "pan"
+action = "ui_pan"
+font_size = 25
+
+[node name="depth+" type="HBoxContainer" parent="panel/inputs/vbox/inputs"]
+layout_mode = 2
+tooltip_text = "While holding the block, pressing this button will move the block further away from the camera."
+script = ExtResource("2_ye7r6")
+_name = "depth far"
+action = "change_depth+"
+font_size = 25
+
+[node name="depth-" type="HBoxContainer" parent="panel/inputs/vbox/inputs"]
+layout_mode = 2
+tooltip_text = "While holding the block, pressing this button will move the block closer to the camera."
+script = ExtResource("2_ye7r6")
+_name = "depth close"
+action = "change_depth-"
+font_size = 25
+
+[node name="freelook" type="HBoxContainer" parent="panel/inputs/vbox/inputs"]
+layout_mode = 2
+tooltip_text = "Pressing this button will rotate the camera, according to the mouse."
+script = ExtResource("2_ye7r6")
+_name = "freelook"
+action = "freelook"
+font_size = 25
+
+[node name="zoom_in" type="HBoxContainer" parent="panel/inputs/vbox/inputs"]
+layout_mode = 2
+tooltip_text = "Zooms the camera in."
+script = ExtResource("2_ye7r6")
+_name = "zoom in"
+action = "zoom_in"
+font_size = 25
+
+[node name="zoom_out" type="HBoxContainer" parent="panel/inputs/vbox/inputs"]
+layout_mode = 2
+tooltip_text = "Zooms the camera out."
+script = ExtResource("2_ye7r6")
+_name = "zoom out"
+action = "zoom_out"
+font_size = 25
diff --git a/ui/editor/track_editor.tscn b/ui/editor/track_editor.tscn
index be566d2..4e61634 100644
--- a/ui/editor/track_editor.tscn
+++ b/ui/editor/track_editor.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=66 format=3 uid="uid://0x720q7tnsj0"]
+[gd_scene load_steps=64 format=3 uid="uid://0x720q7tnsj0"]
[ext_resource type="Script" path="res://ui/editor/tree.gd" id="1_65spq"]
[ext_resource type="Theme" uid="uid://d3ywcokn5ddy8" path="res://ui/theme.tres" id="1_cc7dd"]
@@ -12,7 +12,9 @@
[ext_resource type="Script" path="res://ui/editor/save.gd" id="7_saajs"]
[ext_resource type="Script" path="res://ui/editor/export.gd" id="9_nra4c"]
[ext_resource type="Theme" uid="uid://bds815vxta4ma" path="res://ui/editor/bar_button.tres" id="9_x2saf"]
+[ext_resource type="Script" path="res://ui/editor/help.gd" id="10_i0i6f"]
[ext_resource type="PackedScene" uid="uid://c4h850namjrn2" path="res://ui/editor/propertys.tscn" id="10_kqvab"]
+[ext_resource type="PackedScene" uid="uid://dby5rfnqh7bw8" path="res://ui/editor/help.tscn" id="11_51a7y"]
[ext_resource type="Resource" uid="uid://qxacdpu7fkgb" path="res://ui/editor/editor_fs.tres" id="11_ijop2"]
[ext_resource type="Script" path="res://ui/multi_button.gd" id="11_nar81"]
[ext_resource type="Script" path="res://ui/editor/delete.gd" id="13_agg2r"]
@@ -161,20 +163,6 @@ corner_radius_bottom_left = 15
corner_detail = 12
anti_aliasing_size = 0.397
-[sub_resource type="InputEventMouseButton" id="InputEventMouseButton_sfut2"]
-shift_pressed = true
-button_index = 4
-
-[sub_resource type="Shortcut" id="Shortcut_m8lke"]
-events = [SubResource("InputEventMouseButton_sfut2")]
-
-[sub_resource type="InputEventMouseButton" id="InputEventMouseButton_7fxl4"]
-shift_pressed = true
-button_index = 5
-
-[sub_resource type="Shortcut" id="Shortcut_nokwa"]
-events = [SubResource("InputEventMouseButton_7fxl4")]
-
[sub_resource type="ShaderMaterial" id="ShaderMaterial_y3yf4"]
shader = ExtResource("22_sij02")
shader_parameter/bg_color = Color(0, 0, 0, 0.1)
@@ -253,6 +241,18 @@ shortcut_in_tooltip = false
text = "󰈝"
script = ExtResource("9_nra4c")
+[node name="spacer" type="Control" parent="split/left dock/data/container/buttons"]
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="help" type="Button" parent="split/left dock/data/container/buttons"]
+custom_minimum_size = Vector2(40, 0)
+layout_mode = 2
+tooltip_text = "press it"
+text = ""
+script = ExtResource("10_i0i6f")
+help_scn = ExtResource("11_51a7y")
+
[node name="propertys" parent="split/left dock/data/container" instance=ExtResource("10_kqvab")]
unique_name_in_owner = true
layout_mode = 2
@@ -497,8 +497,6 @@ custom_minimum_size = Vector2(250, 250)
layout_mode = 2
stretch = true
script = ExtResource("17_ugqw3")
-shift_scrollup = SubResource("Shortcut_m8lke")
-shift_scrolldown = SubResource("Shortcut_nokwa")
[node name="port" type="SubViewport" parent="split/split2/middle dock/viewport/view"]
unique_name_in_owner = true