tweaks to controller and savegames are stored by level
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,8 +1,7 @@
|
|||||||
[gd_scene load_steps=48 format=4 uid="uid://ddyfy6iosbgsj"]
|
[gd_scene load_steps=47 format=4 uid="uid://ddyfy6iosbgsj"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_jjeos"]
|
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_jjeos"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b5eclfg0cmmal" path="res://assets/revolver_1.tscn" id="2_7dd4i"]
|
[ext_resource type="PackedScene" uid="uid://b5eclfg0cmmal" path="res://assets/revolver_1.tscn" id="2_7dd4i"]
|
||||||
[ext_resource type="PackedScene" uid="uid://brl0bsqjl5dg3" path="res://assets/mac_10.tscn" id="3_i5y5k"]
|
|
||||||
[ext_resource type="LightmapGIData" uid="uid://boq5kgy4vhxxw" path="res://levels/blockout_3.lmbake" id="4_hwpk3"]
|
[ext_resource type="LightmapGIData" uid="uid://boq5kgy4vhxxw" path="res://levels/blockout_3.lmbake" id="4_hwpk3"]
|
||||||
[ext_resource type="Material" uid="uid://b6hhomp4kcjvb" path="res://assets/materials/prototype/tadaoando.tres" id="4_oo277"]
|
[ext_resource type="Material" uid="uid://b6hhomp4kcjvb" path="res://assets/materials/prototype/tadaoando.tres" id="4_oo277"]
|
||||||
[ext_resource type="Material" uid="uid://isd7ca2ymvs8" path="res://assets/materials/prototype/CeilingLight.tres" id="5_76d5c"]
|
[ext_resource type="Material" uid="uid://isd7ca2ymvs8" path="res://assets/materials/prototype/CeilingLight.tres" id="5_76d5c"]
|
||||||
@@ -346,7 +345,6 @@ size = Vector3(5.505, 7.07, 1.35)
|
|||||||
script = ExtResource("1_jjeos")
|
script = ExtResource("1_jjeos")
|
||||||
player = NodePath("Player")
|
player = NodePath("Player")
|
||||||
gun_1 = ExtResource("2_7dd4i")
|
gun_1 = ExtResource("2_7dd4i")
|
||||||
gun_2 = ExtResource("3_i5y5k")
|
|
||||||
|
|
||||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
environment = SubResource("Environment_ro14g")
|
environment = SubResource("Environment_ro14g")
|
||||||
@@ -354,7 +352,6 @@ camera_attributes = SubResource("CameraAttributesPractical_23vvh")
|
|||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource("6_m8xxf")]
|
[node name="Player" parent="." instance=ExtResource("6_m8xxf")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.281984, 28.8469, 30.8246)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.281984, 28.8469, 30.8246)
|
||||||
AUDIO = false
|
|
||||||
|
|
||||||
[node name="LightmapGI" type="LightmapGI" parent="."]
|
[node name="LightmapGI" type="LightmapGI" parent="."]
|
||||||
quality = 3
|
quality = 3
|
||||||
@@ -511,7 +508,16 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.38419e-07, -1.90735e-06)
|
|||||||
shape = SubResource("BoxShape3D_4andu")
|
shape = SubResource("BoxShape3D_4andu")
|
||||||
|
|
||||||
[node name="Tree1" parent="." instance=ExtResource("20_2qgoy")]
|
[node name="Tree1" parent="." instance=ExtResource("20_2qgoy")]
|
||||||
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -0.668062, -0.93, 0.265823)
|
transform = Transform3D(5, 0, 0, 0, 5, 0, 0, 0, 5, -0.668062, -0.93, 0.265823)
|
||||||
|
|
||||||
|
[node name="SpotLight3D" type="SpotLight3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -2.7933, 45.8303, 4.27025)
|
||||||
|
light_energy = 11.83
|
||||||
|
light_bake_mode = 1
|
||||||
|
shadow_enabled = true
|
||||||
|
spot_range = 54.245
|
||||||
|
spot_attenuation = 0.2
|
||||||
|
spot_angle = 27.1
|
||||||
|
|
||||||
[connection signal="switch_hit" from="Door1/switch/StaticBody3D" to="Door1/switch" method="_on_static_body_3d_switch_hit"]
|
[connection signal="switch_hit" from="Door1/switch/StaticBody3D" to="Door1/switch" method="_on_static_body_3d_switch_hit"]
|
||||||
[connection signal="switch_hit" from="Door1/switch2/StaticBody3D" to="Door1/switch2" method="_on_static_body_3d_switch_hit"]
|
[connection signal="switch_hit" from="Door1/switch2/StaticBody3D" to="Door1/switch2" method="_on_static_body_3d_switch_hit"]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ config_version=5
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="First Person Test"
|
config/name="First Person Test"
|
||||||
run/main_scene="res://scenes/asset_checker.tscn"
|
run/main_scene="res://assets/blockout_2.tscn"
|
||||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
@@ -59,25 +59,21 @@ persist=""
|
|||||||
move_left={
|
move_left={
|
||||||
"deadzone": 0.5,
|
"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":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
"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":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
move_right={
|
move_right={
|
||||||
"deadzone": 0.5,
|
"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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
"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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
move_up={
|
move_up={
|
||||||
"deadzone": 0.5,
|
"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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
"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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
move_down={
|
move_down={
|
||||||
"deadzone": 0.5,
|
"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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
"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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
jump={
|
jump={
|
||||||
@@ -113,6 +109,7 @@ reload={
|
|||||||
inspect={
|
inspect={
|
||||||
"deadzone": 0.5,
|
"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":73,"key_label":0,"unicode":105,"location":0,"echo":false,"script":null)
|
"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":73,"key_label":0,"unicode":105,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":12,"pressure":0.0,"pressed":true,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
scroll_up={
|
scroll_up={
|
||||||
@@ -135,16 +132,19 @@ escape={
|
|||||||
interact={
|
interact={
|
||||||
"deadzone": 0.5,
|
"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":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
|
"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":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
flashlight={
|
flashlight={
|
||||||
"deadzone": 0.5,
|
"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":70,"key_label":0,"unicode":102,"location":0,"echo":false,"script":null)
|
"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":70,"key_label":0,"unicode":102,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":11,"pressure":0.0,"pressed":true,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
kick={
|
kick={
|
||||||
"deadzone": 0.5,
|
"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":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null)
|
"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":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
numb_1={
|
numb_1={
|
||||||
|
|||||||
@@ -309,6 +309,7 @@ shadow_mesh = SubResource("ArrayMesh_7g1e1")
|
|||||||
|
|
||||||
[node name="AssetChecker" type="Node3D" node_paths=PackedStringArray("player")]
|
[node name="AssetChecker" type="Node3D" node_paths=PackedStringArray("player")]
|
||||||
script = ExtResource("1_saj4q")
|
script = ExtResource("1_saj4q")
|
||||||
|
load_save = false
|
||||||
player = NodePath("Player")
|
player = NodePath("Player")
|
||||||
gun_1 = ExtResource("2_ntm2q")
|
gun_1 = ExtResource("2_ntm2q")
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ var dead_player = preload("res://assets/dead_cam.tscn")
|
|||||||
const CLEARED_ANNOUNCE = preload("res://assets/cleared_announce.tscn")
|
const CLEARED_ANNOUNCE = preload("res://assets/cleared_announce.tscn")
|
||||||
const DEAD_ANNOUNCE = preload("res://assets/dead_announce.tscn")
|
const DEAD_ANNOUNCE = preload("res://assets/dead_announce.tscn")
|
||||||
|
|
||||||
|
var level_name
|
||||||
var paused = false
|
var paused = false
|
||||||
var health = start_health
|
var health = start_health
|
||||||
var pickups = []
|
var pickups = []
|
||||||
@@ -43,6 +44,8 @@ var engine_time_scale_cache : float = 1.0
|
|||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
|
level_name = self.get_name()
|
||||||
|
print("LEVEL NAME ",level_name)
|
||||||
#connect to signals
|
#connect to signals
|
||||||
SignalBus.enemy_count_changed.connect(enemy_count)
|
SignalBus.enemy_count_changed.connect(enemy_count)
|
||||||
|
|
||||||
@@ -54,7 +57,10 @@ func _ready():
|
|||||||
GameGlobals.game_loaded = true
|
GameGlobals.game_loaded = true
|
||||||
SignalBus.emit_signal("game_loaded")
|
SignalBus.emit_signal("game_loaded")
|
||||||
else:
|
else:
|
||||||
SaveLoad.load_save_game_data()
|
if SaveLoad.check_save_game_exists(level_name):
|
||||||
|
SaveLoad.load_save_game_data(level_name)
|
||||||
|
else:
|
||||||
|
refresh_scene()
|
||||||
|
|
||||||
#Spawn Crown
|
#Spawn Crown
|
||||||
if SaveLoad.last_hit_path:
|
if SaveLoad.last_hit_path:
|
||||||
@@ -209,5 +215,5 @@ func pause_menu():
|
|||||||
paused = !paused
|
paused = !paused
|
||||||
|
|
||||||
func save_quit():
|
func save_quit():
|
||||||
SaveLoad.save_game_data()
|
SaveLoad.save_game_data(level_name)
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ func _physics_process(delta):
|
|||||||
func picked_up():
|
func picked_up():
|
||||||
player.pickup_sound.pitch_scale = 1 + randf_range(-.3,.3)
|
player.pickup_sound.pitch_scale = 1 + randf_range(-.3,.3)
|
||||||
player.pickup_sound.play()
|
player.pickup_sound.play()
|
||||||
|
Input.start_joy_vibration(0,.1,.1,.1)
|
||||||
match pickupType:
|
match pickupType:
|
||||||
# Ammo
|
# Ammo
|
||||||
0:
|
0:
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ const ADS_POS = Vector3(0,-.05,-.45)
|
|||||||
#JOYSTICK SETTINGS
|
#JOYSTICK SETTINGS
|
||||||
const JOYSTICK_SENSITIVITY = .06
|
const JOYSTICK_SENSITIVITY = .06
|
||||||
var adj_sensitivity = JOYSTICK_SENSITIVITY
|
var adj_sensitivity = JOYSTICK_SENSITIVITY
|
||||||
const JOYSTICK_DEADZONE = 0.05
|
const R_JOYSTICK_DEADZONE = 0.05
|
||||||
|
const L_JOYSTICK_DEADZONE = .2
|
||||||
|
const L_JOYSTICK_SENSITIVITY = .1
|
||||||
|
|
||||||
var speed
|
var speed
|
||||||
var double_jump = true
|
var double_jump = true
|
||||||
@@ -208,9 +210,18 @@ func _physics_process(delta):
|
|||||||
velocity.y += JUMP_VELOCITY
|
velocity.y += JUMP_VELOCITY
|
||||||
double_jump = false
|
double_jump = false
|
||||||
|
|
||||||
# Get the input direction and handle the movement/deceleration.
|
## HANDLE MOVEMENT DIRECTION
|
||||||
var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
var input_dir
|
||||||
var direction = (self.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
var direction
|
||||||
|
#GetKB Input
|
||||||
|
input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||||
|
#Get Joy Input
|
||||||
|
input_dir += joypad_walk()
|
||||||
|
if abs(Input.get_joy_axis(0,JOY_AXIS_LEFT_X)) > L_JOYSTICK_SENSITIVITY or abs(Input.get_joy_axis(0,JOY_AXIS_LEFT_Y)) > L_JOYSTICK_SENSITIVITY:
|
||||||
|
direction = (self.transform.basis * Vector3(input_dir.x, 0, input_dir.y))
|
||||||
|
else:
|
||||||
|
direction = (self.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||||
|
|
||||||
# Handle Sprint
|
# Handle Sprint
|
||||||
if Input.is_action_just_pressed("sprint") and !is_on_floor():
|
if Input.is_action_just_pressed("sprint") and !is_on_floor():
|
||||||
if air_dash > 0:
|
if air_dash > 0:
|
||||||
@@ -287,6 +298,7 @@ func _physics_process(delta):
|
|||||||
var recoil_amount = Vector3(-.3,0,0)
|
var recoil_amount = Vector3(-.3,0,0)
|
||||||
land_sound.volume_db = land_volume
|
land_sound.volume_db = land_volume
|
||||||
land_sound.play()
|
land_sound.play()
|
||||||
|
Input.start_joy_vibration(0,.1,.1,.1)
|
||||||
recoil.add_recoil(recoil_amount,10,10)
|
recoil.add_recoil(recoil_amount,10,10)
|
||||||
moving_fast_top_speed = 0.0
|
moving_fast_top_speed = 0.0
|
||||||
moving_fast = false
|
moving_fast = false
|
||||||
@@ -414,15 +426,28 @@ func _physics_process(delta):
|
|||||||
weapon_sway(delta)
|
weapon_sway(delta)
|
||||||
weapon_bob(velocity.length(), delta)
|
weapon_bob(velocity.length(), delta)
|
||||||
|
|
||||||
|
func joypad_walk():
|
||||||
|
# Joypad right stick look control
|
||||||
|
var dir_out = Vector2(0,0)
|
||||||
|
var xAxis = Input.get_joy_axis(0,JOY_AXIS_LEFT_X)
|
||||||
|
var yAxis = Input.get_joy_axis(0,JOY_AXIS_LEFT_Y)
|
||||||
|
|
||||||
|
if abs(xAxis) > L_JOYSTICK_DEADZONE:
|
||||||
|
dir_out.x = xAxis
|
||||||
|
if abs(yAxis) > L_JOYSTICK_DEADZONE:
|
||||||
|
dir_out.y = yAxis
|
||||||
|
|
||||||
|
return dir_out
|
||||||
|
|
||||||
func joypad_look(delta):
|
func joypad_look(delta):
|
||||||
# Joypad right stick look control
|
# Joypad right stick look control
|
||||||
var xAxis = Input.get_joy_axis(0,JOY_AXIS_RIGHT_X)
|
var xAxis = Input.get_joy_axis(0,JOY_AXIS_RIGHT_X)
|
||||||
var yAxis = Input.get_joy_axis(0,JOY_AXIS_RIGHT_Y)
|
var yAxis = Input.get_joy_axis(0,JOY_AXIS_RIGHT_Y)
|
||||||
var aim_assist
|
var aim_assist
|
||||||
|
|
||||||
if abs(xAxis) > JOYSTICK_DEADZONE:
|
if abs(xAxis) > R_JOYSTICK_DEADZONE:
|
||||||
self.rotate_y(-xAxis * JOYSTICK_SENSITIVITY * 1)
|
self.rotate_y(-xAxis * JOYSTICK_SENSITIVITY * 1)
|
||||||
if abs(yAxis) > JOYSTICK_DEADZONE:
|
if abs(yAxis) > R_JOYSTICK_DEADZONE:
|
||||||
head.rotate_x(-yAxis * JOYSTICK_SENSITIVITY * 1)
|
head.rotate_x(-yAxis * JOYSTICK_SENSITIVITY * 1)
|
||||||
head.rotation.x = clamp(head.rotation.x, deg_to_rad(-90), deg_to_rad(85))
|
head.rotation.x = clamp(head.rotation.x, deg_to_rad(-90), deg_to_rad(85))
|
||||||
|
|
||||||
@@ -471,7 +496,6 @@ func _on_pick_up_detection_body_entered(body):
|
|||||||
if body.is_in_group("pickup"):
|
if body.is_in_group("pickup"):
|
||||||
if body.pickupable:
|
if body.pickupable:
|
||||||
body.picked_up()
|
body.picked_up()
|
||||||
Input.start_joy_vibration(0,.1,.1,.1)
|
|
||||||
if body.is_in_group("weapon_pickup"):
|
if body.is_in_group("weapon_pickup"):
|
||||||
weapon_pickup_audio.play()
|
weapon_pickup_audio.play()
|
||||||
Input.start_joy_vibration(0,.1,.1,.1)
|
Input.start_joy_vibration(0,.1,.1,.1)
|
||||||
@@ -496,9 +520,11 @@ func weapon_tilt(input_x, delta):
|
|||||||
|
|
||||||
func weapon_sway(delta):
|
func weapon_sway(delta):
|
||||||
if !ads:
|
if !ads:
|
||||||
|
var joy_input = Vector2(Input.get_joy_axis(0,JOY_AXIS_RIGHT_X)*5,Input.get_joy_axis(0,JOY_AXIS_RIGHT_Y)*5)
|
||||||
mouse_input = lerp(mouse_input, Vector2.ZERO, 10 * delta)
|
mouse_input = lerp(mouse_input, Vector2.ZERO, 10 * delta)
|
||||||
weapon_holder.rotation.x = lerp(weapon_holder.rotation.x, mouse_input.y * weapon_sway_amount, 5 * delta)
|
joy_input = lerp(joy_input,Vector2.ZERO,10 * delta)
|
||||||
weapon_holder.rotation.y = lerp(weapon_holder.rotation.y, mouse_input.x * weapon_sway_amount, 5 * delta)
|
weapon_holder.rotation.x = lerp(weapon_holder.rotation.x, (mouse_input.y + joy_input.y) * weapon_sway_amount, 5 * delta)
|
||||||
|
weapon_holder.rotation.y = lerp(weapon_holder.rotation.y, (mouse_input.x + joy_input.x) * weapon_sway_amount, 5 * delta)
|
||||||
|
|
||||||
func weapon_bob(vel : float, delta):
|
func weapon_bob(vel : float, delta):
|
||||||
if weapon_holder:
|
if weapon_holder:
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ func fire(delta):
|
|||||||
player.recoil.add_recoil(Vector3(0,recoil_amount.y,recoil_amount.z),10,recoil_speed_change)
|
player.recoil.add_recoil(Vector3(0,recoil_amount.y,recoil_amount.z),10,recoil_speed_change)
|
||||||
player.recoil.add_gun_recoil(recoil_amount.x)
|
player.recoil.add_gun_recoil(recoil_amount.x)
|
||||||
chamber.rotate_object_local(Vector3(0,-1,0),deg_to_rad(60))
|
chamber.rotate_object_local(Vector3(0,-1,0),deg_to_rad(60))
|
||||||
|
Input.start_joy_vibration(0,.5,.9,.2)
|
||||||
|
|
||||||
func reload():
|
func reload():
|
||||||
if level_control.ammo_current[gun_index] < max_ammo and player.gun.anim_player.get_current_animation() != "reload" and level_control.ammo_reserve[gun_index] > 0:
|
if level_control.ammo_current[gun_index] < max_ammo and player.gun.anim_player.get_current_animation() != "reload" and level_control.ammo_reserve[gun_index] > 0:
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ var reserve_ammo
|
|||||||
|
|
||||||
## SAVE DATA PATHS
|
## SAVE DATA PATHS
|
||||||
var persistent_save_path = "user://persistent_data.save"
|
var persistent_save_path = "user://persistent_data.save"
|
||||||
var game_save_path = "user://gamesave.save"
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if player_deaths == null:
|
if player_deaths == null:
|
||||||
@@ -59,9 +58,10 @@ func load_persistent_data():
|
|||||||
enemies_killed = null
|
enemies_killed = null
|
||||||
|
|
||||||
|
|
||||||
func save_game_data():
|
func save_game_data(level_name):
|
||||||
var level_control = get_tree().current_scene
|
var level_control = get_tree().current_scene
|
||||||
var player = level_control.player
|
var player = level_control.player
|
||||||
|
var game_save_path = str("user://",level_name,"_gamesave.save")
|
||||||
var file = FileAccess.open(game_save_path, FileAccess.WRITE)
|
var file = FileAccess.open(game_save_path, FileAccess.WRITE)
|
||||||
|
|
||||||
#ASSIGN DATA TO VARIABLES
|
#ASSIGN DATA TO VARIABLES
|
||||||
@@ -115,10 +115,17 @@ func clear_persistent_data():
|
|||||||
print("PERSISTENT DATA CLEARED")
|
print("PERSISTENT DATA CLEARED")
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
func load_save_game_data():
|
func check_save_game_exists(level_name):
|
||||||
|
var game_save_path = str("user://",level_name,"_gamesave.save")
|
||||||
|
if FileAccess.file_exists(game_save_path):
|
||||||
|
return true
|
||||||
|
else:
|
||||||
|
return false
|
||||||
|
|
||||||
|
func load_save_game_data(level_name):
|
||||||
var level_control = get_tree().current_scene
|
var level_control = get_tree().current_scene
|
||||||
var player = level_control.player
|
var player = level_control.player
|
||||||
|
var game_save_path = str("user://",level_name,"_gamesave.save")
|
||||||
if FileAccess.file_exists(game_save_path):
|
if FileAccess.file_exists(game_save_path):
|
||||||
var file = FileAccess.open(game_save_path, FileAccess.READ)
|
var file = FileAccess.open(game_save_path, FileAccess.READ)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user