Created Handgun and RocketLauncher as descendants of Weapon scene. Instanced them both in Player scene

This commit is contained in:
unfa 2021-12-29 21:31:52 +01:00
parent 8a40e38b70
commit dc0b83efff
4 changed files with 119 additions and 6 deletions

View file

@ -1,11 +1,12 @@
[gd_scene load_steps=46 format=3 uid="uid://cwuys43c7ak61"]
[gd_scene load_steps=47 format=3 uid="uid://cwuys43c7ak61"]
[ext_resource type="Script" path="res://Assets/Characters/Player.gd" id="1"]
[ext_resource type="AudioStream" uid="uid://cy80oknjqs5om" path="res://Assets/SFX/Wind.wav" id="2_4ifi7"]
[ext_resource type="PackedScene" uid="uid://bemrov0tiy08n" path="res://Assets/Weapons/Weapon.tscn" id="3"]
[ext_resource type="Script" path="res://Assets/Audio/WindSFX.gd" id="3_7t4ny"]
[ext_resource type="Texture2D" uid="uid://pnh872qjk0oy" path="res://Assets/Effects/Flame.png" id="3_jw7jd"]
[ext_resource type="PackedScene" uid="uid://sq3wql1r3hod" path="res://Assets/Weapons/Handgun/Handgun.tscn" id="4_7tta1"]
[ext_resource type="AudioStream" uid="uid://bmjh522fpxeee" path="res://Assets/SFX/Player_Jetpack.wav" id="4_k24if"]
[ext_resource type="PackedScene" uid="uid://qc2fug6o4wns" path="res://Assets/Weapons/RocketLauncher/RocketLauncher.tscn" id="4_wnkv6"]
[ext_resource type="AudioStream" uid="uid://3kb1cqt6lcaq" path="res://Assets/SFX/Player_Spawn.wav" id="5_bmajs"]
[ext_resource type="PackedScene" uid="uid://c5cwnfuw4go1b" path="res://Assets/Audio/SoundPlayer.tscn" id="5_yiom2"]
[ext_resource type="AudioStream" uid="uid://dnffb1xcdi2u5" path="res://Assets/SFX/Player_Pain_01.wav" id="6_a4nh8"]
@ -265,7 +266,9 @@ fov = 90.0
[node name="Hand" type="Node3D" parent="Head/Camera"]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.3, -0.4, -0.6)
[node name="Weapon" parent="Head/Camera/Hand" instance=ExtResource( "3" )]
[node name="RocketLauncher" parent="Head/Camera/Hand" instance=ExtResource( "4_wnkv6" )]
[node name="Handgun" parent="Head/Camera/Hand" instance=ExtResource( "4_7tta1" )]
[node name="Tween" type="Node" parent="Head/Camera"]

View file

@ -0,0 +1,17 @@
[gd_scene load_steps=2 format=3 uid="uid://sq3wql1r3hod"]
[ext_resource type="PackedScene" uid="uid://bemrov0tiy08n" path="res://Assets/Weapons/Weapon.tscn" id="1_fpucm"]
[node name="Weapon" instance=ExtResource( "1_fpucm" )]
[node name="Static" parent="Handgun/Handgun_Armature/Skeleton3D" index="0"]
surface_material_override/0 = null
surface_material_override/1 = null
[node name="Hand" parent="Handgun/HandArmature/Skeleton3D2" index="0"]
surface_material_override/0 = null
[editable path="Handgun"]
[editable path="SFX/Shoot A"]
[editable path="SFX/Shoot B"]
[editable path="SFX/Shoot C"]

View file

@ -0,0 +1,93 @@
[gd_scene load_steps=15 format=3 uid="uid://qc2fug6o4wns"]
[ext_resource type="PackedScene" uid="uid://bemrov0tiy08n" path="res://Assets/Weapons/Weapon.tscn" id="1_x28sf"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_0dj5f"]
albedo_color = Color(0, 0, 0, 1)
metallic = 1.0
roughness = 0.0
emission_enabled = true
emission = Color(0.054902, 0.207843, 1, 1)
emission_energy = 16.0
emission_operator = 1
[sub_resource type="OpenSimplexNoise" id="OpenSimplexNoise_vahne"]
[sub_resource type="NoiseTexture" id="NoiseTexture_hoc12"]
seamless = true
noise = SubResource( "OpenSimplexNoise_vahne" )
[sub_resource type="OpenSimplexNoise" id="OpenSimplexNoise_x3lq2"]
[sub_resource type="NoiseTexture" id="NoiseTexture_qdc4e"]
seamless = true
as_normal_map = true
noise = SubResource( "OpenSimplexNoise_x3lq2" )
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_3fpoc"]
transparency = 1
blend_mode = 1
albedo_color = Color(0.478431, 0.478431, 0.478431, 1)
albedo_texture = SubResource( "NoiseTexture_hoc12" )
metallic = 1.0
roughness = 0.46
normal_enabled = true
normal_texture = SubResource( "NoiseTexture_qdc4e" )
uv1_triplanar = true
grow = true
grow_amount = 0.006
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6sfk3"]
next_pass = SubResource( "StandardMaterial3D_3fpoc" )
albedo_color = Color(0.678431, 0.0745098, 0, 1)
metallic = 1.0
roughness = 0.0
uv1_triplanar = true
[sub_resource type="OpenSimplexNoise" id="OpenSimplexNoise_v4ghl"]
[sub_resource type="NoiseTexture" id="NoiseTexture_j68te"]
seamless = true
noise = SubResource( "OpenSimplexNoise_v4ghl" )
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_14dfa"]
transparency = 1
cull_mode = 1
albedo_color = Color(0.513726, 1, 0.129412, 0.329412)
metallic = 1.0
roughness = 0.36
roughness_texture = SubResource( "NoiseTexture_j68te" )
uv1_triplanar = true
grow = true
grow_amount = -0.003
[sub_resource type="OpenSimplexNoise" id="OpenSimplexNoise_mvpai"]
[sub_resource type="NoiseTexture" id="NoiseTexture_4tgn3"]
seamless = true
as_normal_map = true
bump_strength = 20.3
noise = SubResource( "OpenSimplexNoise_mvpai" )
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_f5e1a"]
next_pass = SubResource( "StandardMaterial3D_14dfa" )
cull_mode = 1
albedo_color = Color(0.482353, 0.482353, 0.482353, 1)
roughness = 0.3
normal_enabled = true
normal_texture = SubResource( "NoiseTexture_4tgn3" )
uv1_triplanar = true
[node name="Weapon" instance=ExtResource( "1_x28sf" )]
[node name="Static" parent="Handgun/Handgun_Armature/Skeleton3D" index="0"]
surface_material_override/0 = SubResource( "StandardMaterial3D_0dj5f" )
surface_material_override/1 = SubResource( "StandardMaterial3D_6sfk3" )
[node name="Hand" parent="Handgun/HandArmature/Skeleton3D2" index="0"]
surface_material_override/0 = SubResource( "StandardMaterial3D_f5e1a" )
[editable path="Handgun"]
[editable path="SFX/Shoot A"]
[editable path="SFX/Shoot B"]
[editable path="SFX/Shoot C"]

View file

@ -11,8 +11,8 @@ extends Node3D
var casing = preload("res://Assets/Weapons/Handgun/Casing.tscn")
var flash = preload("res://Assets/Effects/MuzzleFlash.tscn")
var tracer = preload("res://Assets/Effects/BulletTracer.tscn")
var impact_wall = preload("res://Assets/Effects/ImpactSparks.tscn")
#var impact_wall = preload("res://Assets/Effects/ImpactExplosion.tscn")
#var impact_wall = preload("res://Assets/Effects/ImpactSparks.tscn")
var impact_wall = preload("res://Assets/Effects/ImpactExplosion.tscn")
var flyby_sound = preload("res://Assets/Audio/BulletFlyBySoundPlayer.tscn")
@ -61,7 +61,7 @@ var spread = spread_min
var casing_instance = casing.instantiate()
get_tree().root.add_child(casing_instance)
casing_instance.global_transform = ejector.global_transform.translated(player.motion_velocity / 60) #approximating delta
casing_instance.global_transform = ejector.global_transform#approximating delta
casing_instance.linear_velocity = ejector.global_transform.basis[1] * randf_range(3.2, 4.5) + (player.motion_velocity / 2)
casing_instance.angular_velocity.y += randf_range(-10, 10)
casing_instance.angular_velocity.x += randf_range(-10, 10)