minor changes

This commit is contained in:
Derek
2024-07-17 21:03:13 -05:00
parent 77b2ecee74
commit 62c0a89c42
11 changed files with 23 additions and 15 deletions

View File

@@ -2,6 +2,7 @@ extends Node3D
@export var player : Node
@export var money = 250
@export var gun_1 : Resource
@export var gun_2 : Resource
var held_guns = []
@@ -9,7 +10,6 @@ var ammo_current = [0,0]
var ammo_reserve = [0,0]
var guns_dict = {}
var current_gun_index
var money = 0
# Called when the node enters the scene tree for the first time.
func _ready():

View File

@@ -113,7 +113,7 @@ func shoot(player,delta):
instance_casing.position = casing_ejector.global_position
instance_casing.transform.basis = casing_ejector.global_transform.basis
get_tree().get_root().add_child(instance_casing)
player.weapon_recoil()
player.weapon_recoil(delta)
if fire_mode != 0:
cycle_count -= 1

View File

@@ -48,6 +48,7 @@ var recoiling_fade = 0
var bullet_destination
var gun_fire_pitch_starting
var current_weapon_index
var recoiling = false
# Slow Down Variables
const SLOWSPEED = .2
@@ -172,8 +173,8 @@ func _physics_process(delta):
# Gun folding out of the way
if gun_ray.is_colliding() and !gun_ray.get_collider().is_in_group("player"):
#check distance to wall later ?
gun.rotation = lerp(gun.rotation, Vector3(1, 1, -.25), delta * 10)
gun.position = lerp(gun.position, Vector3(gun.start_position.x-.25,gun.start_position.y +.2,gun.start_position.z +.6),(delta*10))
gun.rotation = lerp(gun.rotation, Vector3(1, -1, -.25), delta * 10)
gun.position = lerp(gun.position, Vector3(gun.start_position.x+.25,gun.start_position.y +.2,gun.start_position.z +.6),(delta*10))
gun_folded = true
elif !gun_ray.is_colliding():
gun.rotation = lerp(gun.rotation, gun.start_rotation,delta*7)
@@ -201,6 +202,7 @@ func _physics_process(delta):
if Input.is_action_just_pressed("escape"):
get_tree().quit()
move_and_slide()
weapon_tilt(input_dir.x, delta)
weapon_sway(delta)
@@ -264,7 +266,7 @@ func _on_pick_up_detection_body_entered(body):
var weapon_id = level_control.held_guns.size() - 1
gun.anim_player.play("swap_out")
level_control.gun_spawn(weapon_id)
func _on_pick_up_magnet_body_entered(body):
if body.is_in_group("pickup") and body.is_in_group("magnet"):
@@ -290,6 +292,6 @@ func weapon_bob(vel : float, delta):
weapon_holder.position.y = lerp(weapon_holder.position.y, def_weapon_holder_pos.y, .1 * delta)
weapon_holder.position.x = lerp(weapon_holder.position.x, def_weapon_holder_pos.x, .1 * delta)
func weapon_recoil():
func weapon_recoil(delta):
var recoil_to = camera.rotation.x + gun.recoil_amount
camera.rotation.x = clamp(lerp(camera.rotation.x,recoil_to, .05), deg_to_rad(-90), deg_to_rad(60))

View File

@@ -155,7 +155,7 @@ func fire(delta):
instance_bullet.player = player
instance_bullet.instance_bullethole = bullethole.instantiate()
get_tree().get_root().add_child(instance_bullet)
player.weapon_recoil()
player.weapon_recoil(delta)
chamber.rotate_object_local(Vector3(0,-1,0),deg_to_rad(60))

View File

@@ -24,6 +24,7 @@ func interact():
if level_control.money >= item_price:
level_control.money -= item_price
anim_player.play("vend")
label_3d.text = "vending..."
else:
var original_text = label_3d.text
label_3d.text = "too poor"