fixed jump pad, started work on machete
This commit is contained in:
@@ -170,8 +170,8 @@ func die():
|
||||
get_tree().get_root().add_child(instance_dead)
|
||||
instance_dead.camera.current = true
|
||||
player.dead = true
|
||||
player.toggle_hud(true)
|
||||
player.gun.visible = false
|
||||
player.toggle_hud(false)
|
||||
player.visible = false
|
||||
player.health_indicator.color = Color(0.471, 0, 0, 0)
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ extends Area3D
|
||||
|
||||
@onready var collision_midpoint: Node3D = $CollisionMidpoint
|
||||
|
||||
var player
|
||||
var player_on_ladder = false
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass
|
||||
@@ -10,15 +13,27 @@ func _ready():
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
#if player != null:
|
||||
#if player.is_climbing:
|
||||
#hold_player()
|
||||
|
||||
func _on_body_entered(body):
|
||||
if body.is_in_group("player"):
|
||||
body.is_climbing = true
|
||||
if body.global_position.y < collision_midpoint.global_position.y:
|
||||
body.global_position.y += .2
|
||||
#else:
|
||||
#body.velocity = Vector3(0,0,0)
|
||||
#body.global_position = Vector3(global_position.x,body.global_position.y,global_position.z)
|
||||
|
||||
|
||||
func _on_body_exited(body):
|
||||
if body.is_in_group("player"):
|
||||
body.is_climbing = false
|
||||
player_on_ladder = false
|
||||
body.velocity.y = .1
|
||||
body.gravity = body.default_gravity
|
||||
|
||||
func hold_player():
|
||||
var direction_to_ladder = player.global_position.direction_to(self.global_position)
|
||||
player.velocity = Vector3(direction_to_ladder.x * 10,player.velocity.y,direction_to_ladder.z * 10)
|
||||
|
||||
53
scripts/melee_weapon.gd
Normal file
53
scripts/melee_weapon.gd
Normal file
@@ -0,0 +1,53 @@
|
||||
extends Node3D
|
||||
|
||||
|
||||
@export_group("Gun Feel")
|
||||
@export var gun_name : String
|
||||
@export var gun_icon : Texture2D
|
||||
@export_enum("Light", "Medium", "Heavy", "Shotgun", "Rocket","Melee") var ammo_type: int
|
||||
@export var fov_zoom_amt = 0
|
||||
@export var ads : bool = false
|
||||
@export var recoil_amount : Vector3 = Vector3(0,.2,.2)
|
||||
@export var bullet_damage = 1
|
||||
@export_group("Gun Assets")
|
||||
@export_subgroup("Main Assets")
|
||||
@export var anim_player : Node
|
||||
@export_subgroup("Audio Clips")
|
||||
@export var audio_fire : Node
|
||||
|
||||
@onready var player = get_tree().current_scene.player
|
||||
@onready var level_control = get_tree().current_scene
|
||||
@onready var muzzle_smoke = preload("res://assets/muzzle_smoke.tscn")
|
||||
|
||||
var max_ammo = 0
|
||||
var start_mags = 0
|
||||
var start_position
|
||||
var start_rotation
|
||||
var random_spread_start
|
||||
var cycle_count_start
|
||||
var cycle_count
|
||||
var rng = RandomNumberGenerator.new()
|
||||
var gun_index
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
pass
|
||||
|
||||
func shoot(delta):
|
||||
if !anim_player.is_playing():
|
||||
#audio and anims
|
||||
anim_player.play("shoot")
|
||||
vibration()
|
||||
player.recoil.add_recoil(Vector3(0,recoil_amount.y,recoil_amount.z),10,10)
|
||||
player.recoil.add_gun_recoil(recoil_amount.x)
|
||||
SignalBus.emit_signal("shot_fired")
|
||||
|
||||
func swapped_out():
|
||||
queue_free()
|
||||
|
||||
func vibration():
|
||||
Input.start_joy_vibration(0,.1,.5,.1)
|
||||
@@ -623,7 +623,12 @@ func add_ammo(new_gun,gun_name,ammo_type,max_ammo,start_mags):
|
||||
if ammo_reserve.has(str(ammo_type)):
|
||||
ammo_reserve[str(ammo_type)] += start_mags * max_ammo
|
||||
else:
|
||||
ammo_reserve[str(ammo_type)] = start_mags * max_ammo
|
||||
#if melee weapon don't do max ammo calc
|
||||
if ammo_type == 5:
|
||||
ammo_reserve[str(ammo_type)] = 0
|
||||
#otherwise calculate starting ammo
|
||||
else:
|
||||
ammo_reserve[str(ammo_type)] = start_mags * max_ammo
|
||||
|
||||
print("GUN AMMO ",gun_ammo)
|
||||
print("RESERVE AMMO ", ammo_reserve)
|
||||
|
||||
@@ -139,7 +139,7 @@ func load_save_game_data(level_name):
|
||||
var current_nodes = get_tree().get_nodes_in_group("persist")
|
||||
for i in current_nodes:
|
||||
if i.is_in_group("enemy"):
|
||||
i.quiet_remove()
|
||||
i.queue_free()
|
||||
else:
|
||||
i.queue_free()
|
||||
|
||||
|
||||
@@ -199,9 +199,6 @@ func die():
|
||||
SignalBus.emit_signal("enemy_killed")
|
||||
queue_free()
|
||||
|
||||
func quiet_remove():
|
||||
queue_free()
|
||||
|
||||
func drop_loot(number_of_drops):
|
||||
#pickup drop
|
||||
while number_of_drops > 0:
|
||||
|
||||
@@ -2,7 +2,6 @@ extends RigidBody3D
|
||||
|
||||
@export var gun_resource : Resource
|
||||
@export_enum("Ammo", "Stamina", "Health", "Money","Weapon") var pickupType: int
|
||||
@export var collision_shape : Node
|
||||
|
||||
@onready var level_control = get_tree().current_scene
|
||||
|
||||
|
||||
Reference in New Issue
Block a user