added hold check to interact button
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=111 format=4 uid="uid://6agmt1hqlhww"]
|
||||
[gd_scene load_steps=112 format=4 uid="uid://6agmt1hqlhww"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_sbpvn"]
|
||||
[ext_resource type="PackedScene" uid="uid://brl0bsqjl5dg3" path="res://assets/mac_10.tscn" id="2_fn4vb"]
|
||||
@@ -40,6 +40,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://cdpxctwwi12j" path="res://assets/ladder_collision_check.tscn" id="41_brca2"]
|
||||
[ext_resource type="PackedScene" uid="uid://h05qay3qri4e" path="res://assets/switch_1.tscn" id="42_rmbqr"]
|
||||
[ext_resource type="PackedScene" uid="uid://bcmd7elfjhppe" path="res://assets/tree_1.tscn" id="43_o23bq"]
|
||||
[ext_resource type="PackedScene" uid="uid://bpkmyd3wvqi5p" path="res://assets/boombox.tscn" id="44_dmurd"]
|
||||
[ext_resource type="PackedScene" uid="uid://hp4xn8oqdxnd" path="res://assets/machete_pickup.tscn" id="44_j62x2"]
|
||||
[ext_resource type="PackedScene" uid="uid://dlhjacsike5a4" path="res://assets/oildrum1.tscn" id="45_eatji"]
|
||||
[ext_resource type="PackedScene" uid="uid://bj1y0fbjtul4a" path="res://post_processing.tscn" id="45_lveut"]
|
||||
@@ -2037,6 +2038,9 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.74172, 0.204712, 11.2157)
|
||||
[node name="LadderCollisionCheck2" parent="." instance=ExtResource("41_brca2")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1.62179, 0, 0, 0, 1, -0.0929826, 16.174, 46.5578)
|
||||
|
||||
[node name="Boombox" parent="." instance=ExtResource("44_dmurd")]
|
||||
transform = Transform3D(0.973343, 0, 0.229353, 0, 1, 0, -0.229353, 0, 0.973343, -2.5225, 0.134605, 9.14882)
|
||||
|
||||
[connection signal="body_entered" from="Room1/RoomCheck" to="Room1/RoomCheck" method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="Room1/RoomCheck" to="Room1/RoomCheck" method="_on_body_exited"]
|
||||
[connection signal="body_entered" from="Room3/RoomCheck2" to="Room3/RoomCheck2" method="_on_body_entered"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=10 format=4 uid="uid://bpkmyd3wvqi5p"]
|
||||
[gd_scene load_steps=9 format=4 uid="uid://bpkmyd3wvqi5p"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/boombox.gd" id="1_ccqda"]
|
||||
[ext_resource type="PackedScene" uid="uid://ccnnxudjaptb4" path="res://assets/boombox_broken.tscn" id="2_26e0l"]
|
||||
@@ -78,9 +78,6 @@ _surfaces = [{
|
||||
blend_shape_mode = 0
|
||||
shadow_mesh = SubResource("ArrayMesh_nxwjy")
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_kg5u6"]
|
||||
size = Vector3(2.10059, 1.23395, 0.909241)
|
||||
|
||||
[node name="Boombox" type="RigidBody3D" groups=["breakable", "interact", "moveable", "scene_rigidbody"]]
|
||||
collision_layer = 32
|
||||
collision_mask = 109
|
||||
@@ -103,11 +100,3 @@ transform = Transform3D(0.99997, 0.00767937, 0, -0.00767937, 0.99997, 0, 0, 0, 1
|
||||
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="Music"]
|
||||
stream = ExtResource("3_cr686")
|
||||
autoplay = true
|
||||
|
||||
[node name="Area3D" type="Area3D" parent="." groups=["interact"]]
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00146484, 0.656586, 0.31308)
|
||||
shape = SubResource("BoxShape3D_kg5u6")
|
||||
|
||||
@@ -545,6 +545,7 @@ skeleton = NodePath("")
|
||||
|
||||
[node name="health" type="MeshInstance3D" parent="Meshes"]
|
||||
transform = Transform3D(0.35, 0, 0, 0, 0.35, 0, 0, 0, 0.35, 0, 0, 0)
|
||||
visible = false
|
||||
mesh = SubResource("ArrayMesh_3np6p")
|
||||
skeleton = NodePath("")
|
||||
|
||||
|
||||
@@ -702,7 +702,7 @@ audio_empty = NodePath("Audio/Empty")
|
||||
audio_reload = NodePath("Audio/Reload")
|
||||
|
||||
[node name="mac10" parent="." index="0"]
|
||||
transform = Transform3D(-0.120695, -0.0946482, -0.257826, 0.172433, -0.245315, 0.00933491, -0.213774, -0.144437, 0.153097, 0.948953, -2.62066, 0.655643)
|
||||
transform = Transform3D(-0.120695, -0.0946481, -0.257826, 0.172433, -0.245315, 0.00933494, -0.213774, -0.144437, 0.153096, 0.948953, -2.62066, 0.655643)
|
||||
cast_shadow = 0
|
||||
lod_bias = 10.0
|
||||
mesh = SubResource("ArrayMesh_pcg38")
|
||||
|
||||
@@ -11,7 +11,7 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="First Person Test"
|
||||
run/main_scene="res://scenes/blockout_4.tscn"
|
||||
run/main_scene="res://assets/blockout_2.tscn"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ const HEAD_TILT_AMT = .06
|
||||
const BOB_FREQ = 1.7
|
||||
const BOB_AMP = 0.1
|
||||
const ADS_POS = Vector3(0,-.05,-.3)
|
||||
const HELD_BUTTON_AMT = 1.0 #in seconds
|
||||
|
||||
#JOYSTICK SETTINGS
|
||||
const JOYSTICK_SENSITIVITY = .06
|
||||
@@ -103,6 +104,7 @@ var flashlight_on : bool = false
|
||||
|
||||
##CACHED VARS
|
||||
var weapon_start_pos
|
||||
var held_key_check = 0.0
|
||||
|
||||
# Slow Down Variables
|
||||
var remaining_stamina : float = MAX_STAMINA
|
||||
@@ -437,16 +439,23 @@ func _physics_process(delta):
|
||||
controlled_elsewhere = false
|
||||
|
||||
#interact button
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
if Input.is_action_pressed("interact"):
|
||||
held_key_check += delta
|
||||
## IF HELD
|
||||
if held_key_check >= HELD_BUTTON_AMT:
|
||||
if held_item != null:
|
||||
release_moveable()
|
||||
elif interact_ray.is_colliding():
|
||||
var body = interact_ray.get_collider()
|
||||
if interact_ray.get_collider().is_in_group("interact"):
|
||||
body.get_parent().interact()
|
||||
if interact_ray.get_collider().get_class() == "RigidBody3D":
|
||||
grab_moveable(body)
|
||||
|
||||
held_key_check = 0.0
|
||||
elif Input.is_action_just_released("interact"):
|
||||
if interact_ray.is_colliding():
|
||||
var body = interact_ray.get_collider()
|
||||
if interact_ray.get_collider().has_method("interact"):
|
||||
body.interact()
|
||||
held_key_check = 0.0
|
||||
|
||||
#kick
|
||||
if Input.is_action_just_pressed("kick"):
|
||||
|
||||
Reference in New Issue
Block a user