added sound pack and played with rocket launcher animations
This commit is contained in:
@@ -41,7 +41,6 @@ func _ready():
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
position += transform.basis * Vector3(0, 0, -bullet_speed) * delta
|
||||
print(player_velocity)
|
||||
rotation.x = clamp(rotation.x - delta * bullet_drop,deg_to_rad(-90),deg_to_rad(90))
|
||||
|
||||
distance_from_player = abs(self.global_position - player_position)
|
||||
|
||||
@@ -5,10 +5,10 @@ extends Node3D
|
||||
@export var TIMER_MIN = 0
|
||||
@export var TIMER_MAX = 20
|
||||
|
||||
var stamina = load("res://assets/stamina_pickup.tscn")
|
||||
var ammo = load("res://assets/ammo_pickup.tscn")
|
||||
var jump = load("res://assets/jump_pickup.tscn")
|
||||
var money = load("res://assets/money_1.tscn")
|
||||
@export var stamina : Resource
|
||||
@export var ammo : Resource
|
||||
@export var jump : Resource
|
||||
@export var money : Resource
|
||||
|
||||
@onready var timer = $Timer
|
||||
@onready var cannonparticles = $cannonparticles
|
||||
|
||||
@@ -251,7 +251,7 @@ func _on_pick_up_detection_body_entered(body):
|
||||
pickupmsg = pickup_announce.instantiate()
|
||||
pickupmsg.pickuptext = "ammo"
|
||||
get_parent().add_child(pickupmsg)
|
||||
level_control.ammo_reserve[level_control.current_gun_index] += int((body.rand_amt/100) * gun.max_ammo)
|
||||
level_control.ammo_reserve[level_control.current_gun_index] += clamp(int((body.rand_amt/100) * gun.max_ammo), 1, gun.max_ammo)
|
||||
picked_up = true
|
||||
picked_up_text = "ammo"
|
||||
pickup_sound.pitch_scale = 1 + rng.randf_range(-.3,.3)
|
||||
|
||||
@@ -37,16 +37,24 @@ func _on_body_shape_entered(body_rid, body, body_shape_index, local_shape_index)
|
||||
func explode():
|
||||
#get all collision objects that can be moved
|
||||
var moveable_rigidbodies = blast_radius_area.get_overlapping_bodies()
|
||||
|
||||
#for each object determine vector from center of blast radius
|
||||
#apply linear velocity power as the inverse % of distance towards the edge (bonus points if using curve texture)
|
||||
#break breakable objects
|
||||
for body in moveable_rigidbodies:
|
||||
|
||||
#calculate blast power and direction
|
||||
var blast_direction = (body.global_position - blast_radius_area.global_position).normalized()
|
||||
var blast_amount = 1 - ((body.global_position - blast_radius_area.global_position).length() / blast_radius)
|
||||
var blast_velocity = blast_direction * blast_power * blast_amount
|
||||
|
||||
#apply and/or damage
|
||||
if body.is_in_group("scene_rigidbody"):
|
||||
var blast_direction = (body.global_position - blast_radius_area.global_position).normalized()
|
||||
var blast_amount = 1 - ((body.global_position - blast_radius_area.global_position).length() / blast_radius)
|
||||
var blast_velocity = blast_direction * blast_power * blast_amount
|
||||
if body.is_in_group("breakable"):
|
||||
body.breaking(blast_velocity)
|
||||
else:
|
||||
body.linear_velocity += blast_velocity
|
||||
if body.is_in_group("player"):
|
||||
body.velocity += clamp(blast_velocity,Vector3(-7,-7,-7),Vector3(7,7,7))
|
||||
if body.is_in_group("npc") or body.is_in_group("enemy"):
|
||||
body.velocity += blast_velocity
|
||||
body.breaking(blast_velocity)
|
||||
|
||||
@@ -35,10 +35,10 @@ const MAX_AV = 10
|
||||
@onready var turret = $TurretLook/Turret
|
||||
@onready var turret_material = turret.mesh.surface_get_material(2)
|
||||
|
||||
var stamina = load("res://assets/stamina_pickup.tscn")
|
||||
var ammo = load("res://assets/ammo_pickup.tscn")
|
||||
var money = load("res://assets/money_1.tscn")
|
||||
var die_particles = load("res://assets/die_particles.tscn")
|
||||
@export var stamina : Resource
|
||||
@export var ammo : Resource
|
||||
@export var money : Resource
|
||||
@export var die_particles : Resource
|
||||
@onready var turret_look = $TurretLook
|
||||
|
||||
var particlespawn
|
||||
|
||||
Reference in New Issue
Block a user