Compare commits

...

2 Commits

Author SHA1 Message Date
Kenney 77a16e7baa Progress 2023-10-16 13:53:33 +07:00
Kenney 025f5b50ed Progress 2023-10-16 13:42:39 +07:00
13 changed files with 2 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -13,7 +13,6 @@ var destroyed := false
# When ready, save the initial position
func _ready():
target_position = position
@ -26,10 +25,8 @@ func _process(delta):
position = target_position
# Take damage from player
func damage(amount):
Audio.play("sounds/enemy_hurt.ogg")
@ -38,20 +35,16 @@ func damage(amount):
if health <= 0 and !destroyed:
destroy()
# Destroy the enemy when out of health
func destroy():
Audio.play("sounds/enemy_destroy.ogg")
destroyed = true
queue_free()
# Shoot when timer hits 0
func _on_timer_timeout():
raycast.force_raycast_update()
@ -59,6 +52,7 @@ func _on_timer_timeout():
var collider = raycast.get_collider()
if collider.has_method("damage"): # Raycast collides with player
# Play muzzle flash animation(s)
muzzle_a.frame = 0

@ -78,7 +78,7 @@ func _physics_process(delta):
camera.rotation.x = lerp_angle(camera.rotation.x, rotation_target.x, delta * 25)
rotation.y = lerp_angle(rotation.y, rotation_target.y, delta * 25)
container.position = lerp(container.position, container_offset - (applied_velocity / 30), delta * 10)
container.position = lerp(container.position, container_offset - (basis.inverse() * applied_velocity / 30), delta * 10)
# Movement sound

@ -8,7 +8,6 @@ var bus = "master"
var available = [] # The available players.
var queue = [] # The queue of sounds to play.
func _ready():
for i in num_players:
var p = AudioStreamPlayer.new()
@ -20,16 +19,13 @@ func _ready():
p.finished.connect(_on_stream_finished.bind(p))
p.bus = bus
func _on_stream_finished(stream):
available.append(stream)
func play(sound_path): # Path (or multiple, separated by commas)
var sounds = sound_path.split(",")
queue.append("res://" + sounds[randi() % sounds.size()].strip_edges())
func _process(_delta):
if not queue.is_empty() and not available.is_empty():
available[0].stream = load(queue.pop_front())