minor tweaks and fixed barrel explosion

This commit is contained in:
Derek
2024-12-12 23:46:36 -06:00
parent 90fa39ca4a
commit b6a9e9a112
12 changed files with 308 additions and 50 deletions

View File

@@ -0,0 +1,35 @@
extends Node3D
@onready var top_part: RigidBody3D = $TopPart
@onready var explosion_audio: AudioStreamPlayer3D = $Explosion
@onready var die_particles: GPUParticles3D = $dieParticles
@onready var collision_shapes = [$TopPart/CollisionShape3D, $BottomPart/CollisionShape3D]
const MAX_LV = 20
const MAX_AV = 20
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var lv_x = randf_range(-MAX_LV,MAX_LV)
var lv_y = randf_range(0,MAX_LV)
var lv_z = randf_range(-MAX_LV,MAX_LV)
var av_x = randf_range(-MAX_AV,MAX_AV)
var av_y = randf_range(-MAX_AV,MAX_AV)
var av_z = randf_range(-MAX_AV,MAX_AV)
top_part.linear_velocity += Vector3(lv_x,lv_y,lv_z)
top_part.angular_velocity += Vector3(av_x,av_y,av_z)
explosion_audio.play()
die_particles.emitting = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_timer_timeout() -> void:
for i in collision_shapes:
i.disabled = true
await get_tree().create_timer(1).timeout
queue_free()

View File

@@ -67,7 +67,7 @@ func _physics_process(delta):
leakspawn.rotation.z = deg_to_rad(randf_range(0,360))
if body.is_in_group("switch"):
body.hit()
body.hit(bullet_damage)
if body.is_in_group("breakable"):
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)

View File

@@ -58,7 +58,7 @@ func _on_body_entered(body: Node) -> void:
instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal())
if body.is_in_group("switch"):
body.hit()
body.hit(bullet_damage)
if body.is_in_group("breakable"):

View File

@@ -45,7 +45,7 @@ func _on_body_entered(body: Node) -> void:
if body != null and !body.is_in_group("player") and linear_velocity.length() >= VELOCITY_REQUIRED_TO_HIT:
if body.is_in_group("switch"):
body.hit()
body.hit(bullet_damage)
if body.is_in_group("breakable"):
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)