diff --git a/assets/machete.tscn b/assets/machete.tscn index 6b8b911..d71b47e 100644 --- a/assets/machete.tscn +++ b/assets/machete.tscn @@ -178,7 +178,7 @@ tracks/2/path = NodePath(".") tracks/2/interp = 1 tracks/2/loop_wrap = true tracks/2/keys = { -"times": PackedFloat32Array(0.166667, 0.566667), +"times": PackedFloat32Array(0.166667, 0.266667), "transitions": PackedFloat32Array(1, 1), "values": [{ "args": [], diff --git a/assets/realtime_day_night_cycle.tscn b/assets/realtime_day_night_cycle.tscn index 8f671ce..98cb377 100644 --- a/assets/realtime_day_night_cycle.tscn +++ b/assets/realtime_day_night_cycle.tscn @@ -33,14 +33,15 @@ glow_enabled = true fog_density = 0.0005 [node name="Realtime Day Night Cycle" type="Node3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) script = ExtResource("1_idjmm") sun_color = SubResource("GradientTexture1D_xp6wm") +realtime = true sun_energy_over_time = SubResource("Curve_idjmm") [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource("Environment_ml2st") [node name="Sun" type="DirectionalLight3D" parent="."] -transform = Transform3D(0.969658, -0.064919, 0.235691, -0.0649191, 0.861104, 0.504268, -0.235691, -0.504268, 0.830761, 0, 0, 0) +transform = Transform3D(0.997171, 0.0751772, 0, 0.0642699, -0.852493, 0.518773, 0.0389999, -0.517306, -0.854912, 0, 0, 0) +light_energy = 1.45936 shadow_enabled = true diff --git a/assets/rocket_launcher.tscn b/assets/rocket_launcher.tscn index 100afc5..bd3ea77 100644 --- a/assets/rocket_launcher.tscn +++ b/assets/rocket_launcher.tscn @@ -34,7 +34,6 @@ weapon_type = 0 reload_type = 0 bullet = ExtResource("2_mnla0") fire_mode = 1 -hitscan_range = 100.0 fov_zoom_amt = 0.98 ads = false recoil_amount = Vector3(0.05, 0.05, 0.05) @@ -44,10 +43,15 @@ start_mags = 3 bullet_damage = 1 smoke_enabled = false bullet_force_mod = 5.0 -bullet_speed = 300 +bullet_speed = 100 +vibration_weak_magnitude = 0.1 +vibration_strong_magnitude = 0.5 +vibration_duration = 0.1 +chamber_rot_amount = 60.0 shotgun_spread = Vector3(0.1, 0.1, 0.1) pellets_per_shot = 20 blast_power = 50.0 +hitscan_range = 100.0 [sub_resource type="ShaderMaterial" id="ShaderMaterial_uqdtd"] resource_name = "rocketlauncher12" @@ -611,7 +615,7 @@ skeleton = NodePath("../../../../../../..") [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { -"": SubResource("AnimationLibrary_lrhqi") +&"": SubResource("AnimationLibrary_lrhqi") } [node name="Audio" type="Node3D" parent="."] diff --git a/chest1.tscn b/chest1.tscn index 44575d1..2d322bb 100644 --- a/chest1.tscn +++ b/chest1.tscn @@ -367,7 +367,7 @@ size = Vector3(1, 0.524719, 0.556091) material = ExtResource("17_bp2ds") size = Vector3(1.075, 0.61, 0.575) -[node name="Chest1" type="RigidBody3D" groups=["persist"]] +[node name="Chest1" type="RigidBody3D" node_paths=PackedStringArray("outline_meshes") groups=["persist"]] transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0) collision_layer = 32 collision_mask = 109 @@ -376,6 +376,7 @@ center_of_mass_mode = 1 continuous_cd = true script = ExtResource("1_0qjnf") weapon_drops = Array[Resource]([ExtResource("2_fw6eu"), ExtResource("3_vrqjr"), ExtResource("4_45tks"), ExtResource("5_koj0g"), ExtResource("6_plk4s"), ExtResource("7_t1qyn")]) +outline_meshes = [NodePath("OutlineMesh")] [node name="chest_base" type="MeshInstance3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.263113, 0) @@ -431,6 +432,6 @@ stream = SubResource("AudioStreamRandomizer_hfqb3") transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.235504, -0.00180054) shape = SubResource("BoxShape3D_6k52y") -[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +[node name="OutlineMesh" type="MeshInstance3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.92717e-10, 0.276406, 0.00334829) mesh = SubResource("BoxMesh_bp2ds") diff --git a/hud.tscn b/hud.tscn index 6026ed3..0f975aa 100644 --- a/hud.tscn +++ b/hud.tscn @@ -34,56 +34,12 @@ grow_vertical = 2 script = ExtResource("1_7hukm") radial_stamina = true -[node name="Money" type="Label" parent="."] -layout_mode = 1 -anchors_preset = 2 -anchor_top = 1.0 -anchor_bottom = 1.0 -offset_left = 44.975 -offset_top = -273.09 -offset_right = 244.975 -offset_bottom = -142.09 -grow_vertical = 0 -theme = ExtResource("1_22trs") -theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) -theme_override_font_sizes/font_size = 125 -text = "$" +[node name="StaticItems" type="Control" parent="."] +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 -[node name="HealthBar" type="ProgressBar" parent="."] -custom_minimum_size = Vector2(300, 50) -layout_mode = 1 -anchors_preset = 2 -anchor_top = 1.0 -anchor_bottom = 1.0 -offset_left = 50.38 -offset_top = -105.315 -offset_right = 350.38 -offset_bottom = -55.315 -grow_vertical = 0 -theme = ExtResource("1_22trs") -theme_override_styles/background = SubResource("StyleBoxFlat_2hn4h") -theme_override_styles/fill = SubResource("StyleBoxFlat_axtce") -value = 30.45 -show_percentage = false - -[node name="LeftMargin" type="MarginContainer" parent="."] -layout_mode = 1 -anchors_preset = 2 -anchor_top = 1.0 -anchor_bottom = 1.0 -offset_top = -125.0 -offset_right = 300.0 -grow_vertical = 0 -theme_override_constants/margin_left = 50 -theme_override_constants/margin_top = 50 -theme_override_constants/margin_right = 50 -theme_override_constants/margin_bottom = 50 - -[node name="VBoxContainer" type="VBoxContainer" parent="LeftMargin"] -layout_mode = 2 -theme_override_constants/separation = 10 - -[node name="StaminaBar2" type="ProgressBar" parent="."] +[node name="StaminaBar2" type="ProgressBar" parent="StaticItems"] custom_minimum_size = Vector2(30, 10) layout_mode = 1 anchors_preset = 8 @@ -91,10 +47,10 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = 50.0 -offset_top = 27.0 -offset_right = 105.0 -offset_bottom = 37.0 +offset_left = 606.0 +offset_top = 331.0 +offset_right = 661.0 +offset_bottom = 341.0 grow_horizontal = 2 grow_vertical = 2 rotation = -1.5708 @@ -104,7 +60,7 @@ theme_override_styles/fill = SubResource("StyleBoxFlat_axtce") value = 35.29 show_percentage = false -[node name="Crosshair" type="TextureRect" parent="." groups=["hud"]] +[node name="Crosshair" type="TextureRect" parent="StaticItems" groups=["hud"]] layout_mode = 0 offset_right = 396.0 offset_bottom = 396.0 @@ -112,7 +68,7 @@ texture = ExtResource("3_mgrwc") expand_mode = 3 stretch_mode = 4 -[node name="CrosshairCenter" type="TextureRect" parent="." groups=["hud"]] +[node name="CrosshairCenter" type="TextureRect" parent="StaticItems" groups=["hud"]] layout_mode = 0 offset_right = 396.0 offset_bottom = 396.0 @@ -121,7 +77,7 @@ texture = ExtResource("4_61fkt") expand_mode = 3 stretch_mode = 4 -[node name="StaminaBar" type="TextureProgressBar" parent="."] +[node name="StaminaBar" type="TextureProgressBar" parent="StaticItems"] material = SubResource("CanvasItemMaterial_ytfhs") layout_mode = 0 offset_right = 370.0 @@ -131,15 +87,77 @@ value = 49.0 fill_mode = 5 texture_progress = ExtResource("4_ooaul") -[node name="GunInfo" type="MarginContainer" parent="."] +[node name="WobbleItems" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Money" type="Label" parent="WobbleItems"] +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_left = 44.975 +offset_top = 334.91 +offset_right = 244.975 +offset_bottom = 465.91 +grow_vertical = 0 +theme = ExtResource("1_22trs") +theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 125 +text = "$" + +[node name="HealthBar" type="ProgressBar" parent="WobbleItems"] +custom_minimum_size = Vector2(300, 50) +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_left = 50.38 +offset_top = 502.685 +offset_right = 350.38 +offset_bottom = 552.685 +grow_vertical = 0 +theme = ExtResource("1_22trs") +theme_override_styles/background = SubResource("StyleBoxFlat_2hn4h") +theme_override_styles/fill = SubResource("StyleBoxFlat_axtce") +value = 30.45 +show_percentage = false + +[node name="LeftMargin" type="MarginContainer" parent="WobbleItems"] +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_top = 483.0 +offset_right = 300.0 +offset_bottom = 608.0 +grow_vertical = 0 +theme_override_constants/margin_left = 50 +theme_override_constants/margin_top = 50 +theme_override_constants/margin_right = 50 +theme_override_constants/margin_bottom = 50 + +[node name="VBoxContainer" type="VBoxContainer" parent="WobbleItems/LeftMargin"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="GunInfo" type="MarginContainer" parent="WobbleItems"] layout_mode = 1 anchors_preset = 3 anchor_left = 1.0 anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -734.0 -offset_top = -372.0 +offset_left = 378.0 +offset_top = 236.0 +offset_right = 1112.0 +offset_bottom = 608.0 grow_horizontal = 0 grow_vertical = 0 theme = ExtResource("1_22trs") @@ -148,7 +166,7 @@ theme_override_constants/margin_top = 50 theme_override_constants/margin_right = 50 theme_override_constants/margin_bottom = 50 -[node name="VBoxContainer" type="VBoxContainer" parent="GunInfo"] +[node name="VBoxContainer" type="VBoxContainer" parent="WobbleItems/GunInfo"] layout_mode = 2 size_flags_horizontal = 8 size_flags_vertical = 8 @@ -156,7 +174,7 @@ theme = ExtResource("1_22trs") theme_override_constants/separation = 10 alignment = 2 -[node name="Gun Name" type="Label" parent="GunInfo/VBoxContainer"] +[node name="Gun Name" type="Label" parent="WobbleItems/GunInfo/VBoxContainer"] layout_mode = 2 theme = ExtResource("1_22trs") theme_type_variation = &"TextShadow" @@ -165,26 +183,26 @@ theme_override_constants/outline_size = 15 text = "Gun Name" horizontal_alignment = 2 -[node name="AmmoCounter" type="HBoxContainer" parent="GunInfo/VBoxContainer"] +[node name="AmmoCounter" type="HBoxContainer" parent="WobbleItems/GunInfo/VBoxContainer"] layout_mode = 2 size_flags_vertical = 3 theme = ExtResource("1_22trs") theme_override_constants/separation = 50 alignment = 2 -[node name="AmmoCurrent" type="Label" parent="GunInfo/VBoxContainer/AmmoCounter"] +[node name="AmmoCurrent" type="Label" parent="WobbleItems/GunInfo/VBoxContainer/AmmoCounter"] layout_mode = 2 theme = ExtResource("1_22trs") theme_override_constants/outline_size = 15 text = "XXX" horizontal_alignment = 2 -[node name="Label" type="Label" parent="GunInfo/VBoxContainer/AmmoCounter"] +[node name="Label" type="Label" parent="WobbleItems/GunInfo/VBoxContainer/AmmoCounter"] layout_mode = 2 theme_override_constants/outline_size = 15 text = "-" -[node name="AmmoReserve" type="Label" parent="GunInfo/VBoxContainer/AmmoCounter"] +[node name="AmmoReserve" type="Label" parent="WobbleItems/GunInfo/VBoxContainer/AmmoCounter"] layout_mode = 2 theme = ExtResource("1_22trs") theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) diff --git a/project.godot b/project.godot index c47dead..75edce3 100644 --- a/project.godot +++ b/project.godot @@ -14,13 +14,12 @@ config/name="First Person Test" config/tags=PackedStringArray("fps") run/main_scene="uid://f7e0v1r6ra6c" config/features=PackedStringArray("4.4", "Forward Plus") -config/icon="res://icon.svg" +config/icon="uid://gx3iw54iemho" [autoload] SaveLoad="*res://scripts/save_load.gd" SignalBus="*res://scripts/signal_bus.gd" -SwitchBasic="*res://scripts/switch_basic.gd" RigidbodyGeneric="*res://scripts/rigidbody_generic.gd" GameGlobals="*res://scripts/game_globals.gd" HelperFuncs="*res://scripts/HelperFuncs.gd" diff --git a/scenes/asset_checker.tscn b/scenes/asset_checker.tscn index ba79bd5..c281c9c 100644 --- a/scenes/asset_checker.tscn +++ b/scenes/asset_checker.tscn @@ -331,7 +331,6 @@ _data = { [node name="Realtime Day Night Cycle" parent="." instance=ExtResource("26_qoxo0")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.9891, 1.53028, 4.26966) set_time = 18.25 -north_offset = null [node name="CSGBox3D" type="CSGBox3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.54059, -4.88213, 0) diff --git a/scripts/chest_1.gd b/scripts/chest_1.gd index ae22d02..5ff4bd5 100644 --- a/scripts/chest_1.gd +++ b/scripts/chest_1.gd @@ -3,6 +3,7 @@ class_name Chest @export var weapon_drops : Array[Resource] @export var health : float = 30 +@export var outline_meshes : Array[MeshInstance3D] @onready var serial_label: Label3D = $chest_lid/serial_number var serial_number @@ -29,9 +30,15 @@ func _process(delta: float) -> void: func hit(dam): health -= dam if !open and health <= 0: - anim_player.play("open") - open = true - + open_chest() + +func open_chest(): + anim_player.play("open") + if outline_meshes != null: + for i in outline_meshes: + i.visible = false + open = true + func spawn_drop(): drop_weapon.position = item_spawn.global_position drop_weapon.transform.basis = item_spawn.global_transform.basis diff --git a/scripts/hud.gd b/scripts/hud.gd index f6108a6..f195de5 100644 --- a/scripts/hud.gd +++ b/scripts/hud.gd @@ -16,18 +16,19 @@ var crosshair_target @onready var level_control = get_tree().current_scene @onready var player = level_control.player -@onready var stamina_bar: TextureProgressBar = $StaminaBar -@onready var stamina_bar_2: ProgressBar = $StaminaBar2 -@onready var health_bar: ProgressBar = $HealthBar -@onready var ammo_counter: HBoxContainer = $GunInfo/VBoxContainer/AmmoCounter -@onready var gun_name: Label = $"GunInfo/VBoxContainer/Gun Name" -@onready var ammo_current: Label = $GunInfo/VBoxContainer/AmmoCounter/AmmoCurrent -@onready var ammo_reserve: Label = $GunInfo/VBoxContainer/AmmoCounter/AmmoReserve -@onready var gun_info: MarginContainer = $GunInfo -@onready var money: Label = $Money -@onready var crosshair: TextureRect = $Crosshair -@onready var crosshair_center: TextureRect = $CrosshairCenter +@onready var stamina_bar: TextureProgressBar = $StaticItems/StaminaBar +@onready var stamina_bar_2: ProgressBar = $StaticItems/StaminaBar2 +@onready var health_bar: ProgressBar = $WobbleItems/HealthBar +@onready var ammo_counter: HBoxContainer = $WobbleItems/GunInfo/VBoxContainer/AmmoCounter +@onready var gun_name: Label = $"WobbleItems/GunInfo/VBoxContainer/Gun Name" +@onready var ammo_current: Label = $WobbleItems/GunInfo/VBoxContainer/AmmoCounter/AmmoCurrent +@onready var ammo_reserve: Label = $WobbleItems/GunInfo/VBoxContainer/AmmoCounter/AmmoReserve +@onready var gun_info: MarginContainer = $WobbleItems/GunInfo +@onready var money: Label = $WobbleItems/Money +@onready var crosshair: TextureRect = $StaticItems/Crosshair +@onready var crosshair_center: TextureRect = $StaticItems/CrosshairCenter @onready var pickup_item_indicator = preload("res://assets/pickup_item_indicator.tscn") +@onready var wobble_items: Control = $WobbleItems const FULL_WHITE = Color(1, 1, 1, 1) const TRANSPARENT = Color(1, 1, 1, 0) @@ -173,6 +174,8 @@ func _process(delta: float) -> void: ## SPAWN NOTIFICATIONS spawn_notifs() + + wobble_items.position = hud_wobble(delta) func crosshair_size_change(): crosshair_target += Vector2(20,20) @@ -220,3 +223,20 @@ func spawn_notifs(): func player_hit(): crosshair_size_change() + +func hud_wobble(delta): + var viewport_height_adj = (get_viewport().size.y/1080) + + var HUD_WOBBLE_MAX : float = 40 * viewport_height_adj + var MOUSE_AMT = 10 * viewport_height_adj + var VELOCITY_AMT = 100 * viewport_height_adj + var HUD_SPEED = 10 * viewport_height_adj + + var dir_mouse = Vector2(-player.mouse_input.x * MOUSE_AMT,-player.mouse_input.y * MOUSE_AMT) + var velocity_dir_transformed = player.velocity.normalized() * player.global_basis + var velocity_lengh_clamped = clamp(player.velocity.length(),-VELOCITY_AMT,VELOCITY_AMT) + var dir_velocity = Vector2(-velocity_dir_transformed.x * velocity_lengh_clamped,velocity_dir_transformed.y * velocity_lengh_clamped) + var dir_clamped = clamp(dir_mouse + dir_velocity,Vector2(-HUD_WOBBLE_MAX,-HUD_WOBBLE_MAX),Vector2(HUD_WOBBLE_MAX,HUD_WOBBLE_MAX)) + var offset = lerp(position, dir_clamped, delta * HUD_SPEED) + + return offset diff --git a/scripts/player.gd b/scripts/player.gd index 84634be..4fca0f9 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -476,7 +476,6 @@ func _physics_process(delta): joypad_look() aim_down_sights(delta) flashlight_toggle() - hud_wobble(delta) hold_item(delta) move_and_slide() crouch(delta) @@ -591,23 +590,6 @@ func aim_down_sights(delta): else: gun.position = lerp(gun.position, weapon_start_pos,(delta * 100)/Engine.time_scale) -func hud_wobble(delta): - var viewport_height_adj = (get_viewport().size.y/1080) - - var HUD_WOBBLE_MAX : float = 40 * viewport_height_adj - var MOUSE_AMT = 10 * viewport_height_adj - var VELOCITY_AMT = 100 * viewport_height_adj - var HUD_SPEED = 10 * viewport_height_adj - - var dir_mouse = Vector2(-mouse_input.x * MOUSE_AMT,-mouse_input.y * MOUSE_AMT) - var velocity_dir_transformed = velocity.normalized() * global_basis - var velocity_lengh_clamped = clamp(velocity.length(),-VELOCITY_AMT,VELOCITY_AMT) - var dir_velocity = Vector2(-velocity_dir_transformed.x * velocity_lengh_clamped,velocity_dir_transformed.y * velocity_lengh_clamped) - var dir_clamped = clamp(dir_mouse + dir_velocity,Vector2(-HUD_WOBBLE_MAX,-HUD_WOBBLE_MAX),Vector2(HUD_WOBBLE_MAX,HUD_WOBBLE_MAX)) - var offset = lerp(hud.position, dir_clamped, delta * HUD_SPEED) - hud.position = offset - hud.crosshair.position = -offset - func grab_moveable(body): held_item_cache = { "gravity_scale" : body.gravity_scale diff --git a/scripts/projectile.gd b/scripts/projectile.gd index 4e0a9d8..ccf2bd0 100644 --- a/scripts/projectile.gd +++ b/scripts/projectile.gd @@ -10,3 +10,12 @@ var bullet_force_mod var bullet_speed var blast_power var blast_radius + +func _ready() -> void: + visible = false + +func _process(delta: float) -> void: + var distance_from_player = abs(self.global_position - player_position) + + if distance_from_player.length() > 2: + visible = true diff --git a/scripts/rigidbody_generic.gd b/scripts/rigidbody_generic.gd index e22d3a5..44944e5 100644 --- a/scripts/rigidbody_generic.gd +++ b/scripts/rigidbody_generic.gd @@ -5,11 +5,6 @@ extends RigidBody3D func _ready() -> void: add_to_group("persist") - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass - func save(): var save_dict = { "filename" : get_scene_file_path(),