added punch animation and can now melee enemies
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=112 format=4 uid="uid://6agmt1hqlhww"]
|
||||
[gd_scene load_steps=108 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"]
|
||||
@@ -37,11 +37,7 @@
|
||||
[ext_resource type="Script" path="res://scripts/switch_interactandshoot.gd" id="35_ybetb"]
|
||||
[ext_resource type="Script" path="res://levels/switch_target.gd" id="36_fuepo"]
|
||||
[ext_resource type="PackedScene" uid="uid://cucqbjb8bcha5" path="res://assets/blunderbuss_pickup.tscn" id="38_1e38i"]
|
||||
[ext_resource type="PackedScene" uid="uid://bww5k3t3yu7m0" path="res://assets/mug.tscn" id="40_il4b1"]
|
||||
[ext_resource type="PackedScene" uid="uid://co12h258tg1ud" path="res://assets/wet_floor_sign.tscn" id="41_h2hhd"]
|
||||
[ext_resource type="PackedScene" uid="uid://ciw10g8q4td1y" path="res://assets/tv.tscn" id="42_5scug"]
|
||||
[ext_resource type="PackedScene" uid="uid://bcmd7elfjhppe" path="res://assets/tree_1.tscn" id="43_o23bq"]
|
||||
[ext_resource type="PackedScene" uid="uid://df34olntmk0wl" path="res://assets/vent_1.tscn" id="44_b0rr7"]
|
||||
[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"]
|
||||
|
||||
@@ -1062,6 +1058,7 @@ transform = Transform3D(0.0198257, 0, 0.999803, 0, 1, 0, -0.999803, 0, 0.0198257
|
||||
[node name="Room1" type="Node" parent="."]
|
||||
script = ExtResource("13_84vop")
|
||||
room_lockdown = true
|
||||
key_drop = true
|
||||
|
||||
[node name="spider" parent="Room1" instance=ExtResource("8_h7fp0")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.13669, -0.399995, 1.3536)
|
||||
@@ -2009,25 +2006,13 @@ autoplay = "HallSpikes"
|
||||
[node name="blunderbuss_pickup" parent="." instance=ExtResource("38_1e38i")]
|
||||
transform = Transform3D(0.680363, 0, 0.732875, 0, 1, 0, -0.732875, 0, 0.680363, -2.95896, 1.92659, 16.5021)
|
||||
|
||||
[node name="Mug" parent="." instance=ExtResource("40_il4b1")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.82237, 1.87648, 13.6332)
|
||||
|
||||
[node name="WetFloorSign" parent="." instance=ExtResource("41_h2hhd")]
|
||||
transform = Transform3D(-0.514973, 0, 1.40883, 0, 1.5, 0, -1.40883, 0, -0.514973, -2.71954, 0.612816, 12.0582)
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.38495, 2.76978, 14.3463)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="TV" parent="." instance=ExtResource("42_5scug")]
|
||||
transform = Transform3D(0.169259, 0, 1.49042, 0, 1.5, 0, -1.49042, 0, 0.169259, -2.75525, 1.73891, 12.7455)
|
||||
|
||||
[node name="Tree1" parent="." instance=ExtResource("43_o23bq")]
|
||||
transform = Transform3D(4.135, 0, 0, 0, 4.135, 0, 0, 0, 4.135, 26.563, 13.3468, 261.018)
|
||||
|
||||
[node name="Vent1" parent="." instance=ExtResource("44_b0rr7")]
|
||||
transform = Transform3D(0.462863, 0, 0.88643, 0, 1, 0, -0.88643, 0, 0.462863, -1.87132, 0.546506, 10.544)
|
||||
|
||||
[node name="Oildrum1" parent="." instance=ExtResource("45_eatji")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.46674, 27.457, -7.49986)
|
||||
|
||||
|
||||
@@ -702,7 +702,7 @@ audio_empty = NodePath("Audio/Empty")
|
||||
audio_reload = NodePath("Audio/Reload")
|
||||
|
||||
[node name="mac10" parent="." index="0"]
|
||||
transform = Transform3D(-1.08301e-06, -8.05094e-08, -0.3, -0.0225093, 0.299154, 9.76756e-10, 0.299154, 0.0225093, -1.086e-06, -0.00876398, 0.0748287, -0.0557729)
|
||||
transform = Transform3D(-1.08301e-06, -8.05088e-08, -0.3, -0.0225093, 0.299154, 9.77362e-10, 0.299154, 0.0225093, -1.086e-06, -0.00876398, 0.0748287, -0.0557729)
|
||||
cast_shadow = 0
|
||||
lod_bias = 10.0
|
||||
mesh = SubResource("ArrayMesh_pcg38")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=35 format=3 uid="uid://drwae3loscbw7"]
|
||||
[gd_scene load_steps=38 format=3 uid="uid://drwae3loscbw7"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/player.gd" id="1_x7wms"]
|
||||
[ext_resource type="Script" path="res://scripts/recoil.gd" id="3_405jc"]
|
||||
@@ -36,8 +36,6 @@ radius = 0.509802
|
||||
height = 1.19106
|
||||
|
||||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_vhypf"]
|
||||
dof_blur_far_enabled = true
|
||||
dof_blur_near_enabled = true
|
||||
dof_blur_amount = 0.3
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_vupcx"]
|
||||
@@ -80,6 +78,55 @@ random_pitch = 2.0
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("19_pi7h7")
|
||||
|
||||
[sub_resource type="Animation" id="Animation_llq31"]
|
||||
resource_name = "punch"
|
||||
length = 0.75
|
||||
step = 0.01
|
||||
tracks/0/type = "method"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.3),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"punch"
|
||||
}]
|
||||
}
|
||||
tracks/1/type = "position_3d"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Head/Recoil/Camera3D/WeaponHolder")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = PackedFloat32Array(0, 1, 0, -0.0341401, -0.111267, 0.19, 1, 0.0274239, -0.455616, 0.416463, 0.23, 1, 0.0346386, -0.441928, 0.312534, 0.3, 1, 0.129892, -0.454487, -0.652062, 0.37, 1, 0.091674, -0.439886, -0.496679, 0.75, 1, 0, -0.0341401, -0.111267)
|
||||
tracks/2/type = "rotation_3d"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Head/Recoil/Camera3D/WeaponHolder")
|
||||
tracks/2/interp = 2
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = PackedFloat32Array(0, 1, 0, 0, 0, 1, 0.19, 1, 0.429604, -0.0899337, -0.184524, 0.879377, 0.23, 1, 0.404158, -0.0814679, -0.189232, 0.891186, 0.3, 1, 0.0843464, 0.014675, -0.188657, 0.978305, 0.37, 1, 0.124325, 0.0221516, -0.181308, 0.975285, 0.75, 1, 0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_q5egb"]
|
||||
length = 0.001
|
||||
tracks/0/type = "position_3d"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Head/Recoil/Camera3D/WeaponHolder")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = PackedFloat32Array(0, 1, 0, -0.0341401, -0.111267)
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_d0x8a"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_q5egb"),
|
||||
"punch": SubResource("Animation_llq31")
|
||||
}
|
||||
|
||||
[node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("weapon_holder") groups=["persist", "player"]]
|
||||
transform = Transform3D(1, 0.000164476, 0.000583754, -0.000165075, 0.999999, 0.00104027, -0.000583585, -0.00104036, 0.999999, 0, 1.11359, 0)
|
||||
collision_layer = 6
|
||||
@@ -180,7 +227,7 @@ script = ExtResource("10_ektr6")
|
||||
[node name="InteractRay" type="RayCast3D" parent="Head/Recoil/Camera3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.00322104, -0.0232438)
|
||||
target_position = Vector3(0, 0, -2.5)
|
||||
collision_mask = 34
|
||||
collision_mask = 162
|
||||
hit_back_faces = false
|
||||
collide_with_areas = true
|
||||
|
||||
@@ -261,6 +308,11 @@ stream = SubResource("AudioStreamRandomizer_u5cxn")
|
||||
[node name="Crouch" type="AudioStreamPlayer3D" parent="Audio"]
|
||||
stream = SubResource("AudioStreamRandomizer_xswn0")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_d0x8a")
|
||||
}
|
||||
|
||||
[connection signal="tree_entered" from="." to="." method="_on_tree_entered"]
|
||||
[connection signal="body_entered" from="pick_up_detection" to="." method="_on_pick_up_detection_body_entered"]
|
||||
[connection signal="body_entered" from="pick_up_magnet" to="." method="_on_pick_up_magnet_body_entered"]
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -81,24 +81,24 @@ func save():
|
||||
return save_dict
|
||||
|
||||
func activate_mesh():
|
||||
match pickup_type:
|
||||
0:
|
||||
match ammo_type:
|
||||
0:
|
||||
match str(pickup_type):
|
||||
"0":
|
||||
match str(ammo_type):
|
||||
"0":
|
||||
light_ammo.visible = true
|
||||
1:
|
||||
"1":
|
||||
medium_ammo.visible = true #medium
|
||||
2:
|
||||
"2":
|
||||
heavy_ammo.visible = true #heavy
|
||||
3:
|
||||
"3":
|
||||
shotgun_ammo.visible = true #shotgun
|
||||
4:
|
||||
"4":
|
||||
rocket.visible = true #rocket
|
||||
1:
|
||||
"1":
|
||||
stamina.visible = true
|
||||
2:
|
||||
"2":
|
||||
health.visible = true
|
||||
3:
|
||||
"3":
|
||||
money.visible = true
|
||||
|
||||
mesh_activated = true
|
||||
|
||||
@@ -112,6 +112,7 @@ var dead_announce = load("res://assets/dead_announce.tscn")
|
||||
var pickupmsg
|
||||
var controlled_elsewhere = false
|
||||
|
||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||
@onready var crosshair = $Head/Recoil/Camera3D/Crosshair
|
||||
@onready var head = $Head
|
||||
@onready var camera = $Head/Recoil/Camera3D
|
||||
@@ -446,16 +447,8 @@ func _physics_process(delta):
|
||||
|
||||
#kick
|
||||
if Input.is_action_just_pressed("kick"):
|
||||
if interact_ray.is_colliding():
|
||||
if interact_ray.get_collider().get_class() == "RigidBody3D":
|
||||
kick_audio.play()
|
||||
interact_ray.get_collider().linear_velocity += interact_ray.global_transform.basis * Vector3(0,0, -KICK_AMOUNT)
|
||||
if held_item != null:
|
||||
release_moveable()
|
||||
if held_item != null:
|
||||
kick_audio.play()
|
||||
held_item.linear_velocity += interact_ray.global_transform.basis * Vector3(0,0, -KICK_AMOUNT)
|
||||
release_moveable()
|
||||
if !animation_player.is_playing():
|
||||
animation_player.play("punch")
|
||||
|
||||
if Input.is_action_just_pressed("kill_self"):
|
||||
level_control.health = 0
|
||||
@@ -501,6 +494,21 @@ func joypad_look(delta):
|
||||
head.rotate_x(-yAxis * JOYSTICK_SENSITIVITY * 1)
|
||||
head.rotation.x = clamp(head.rotation.x, deg_to_rad(-90), deg_to_rad(85))
|
||||
|
||||
func punch():
|
||||
if interact_ray.is_colliding():
|
||||
if interact_ray.get_collider().has_method("hit"):
|
||||
hit_indicator.play()
|
||||
interact_ray.get_collider().hit(3)
|
||||
if interact_ray.get_collider().get_class() == "RigidBody3D":
|
||||
kick_audio.play()
|
||||
interact_ray.get_collider().linear_velocity += interact_ray.global_transform.basis * Vector3(0,0, -KICK_AMOUNT)
|
||||
if held_item != null:
|
||||
release_moveable()
|
||||
if held_item != null:
|
||||
kick_audio.play()
|
||||
held_item.linear_velocity += interact_ray.global_transform.basis * Vector3(0,0, -KICK_AMOUNT)
|
||||
release_moveable()
|
||||
|
||||
func crouch(delta):
|
||||
if crouched:
|
||||
crouching_collision.disabled = false
|
||||
@@ -662,7 +670,8 @@ func pickup_apply(type,ammo_type,value):
|
||||
func focus_on_target():
|
||||
if Engine.time_scale < 1:
|
||||
const BLUR_AMOUNT = .1
|
||||
camera.attributes.dof_blur_far_enabled = false
|
||||
camera.attributes.dof_blur_far_enabled = true
|
||||
camera.attributes.dof_blur_far_distance = camera.global_position.distance_to(bullet_ray.get_collision_point()) + 5.0
|
||||
camera.attributes.dof_blur_near_enabled = true
|
||||
camera.attributes.dof_blur_amount = lerp(0.0,BLUR_AMOUNT,1.0 - Engine.time_scale)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user