Fix Ricochet

main
Luna Brovchuk 2023-10-02 20:31:18 +02:00
parent c513c48f8b
commit 4f32f718c6
5 changed files with 12 additions and 9 deletions

View File

@ -42,7 +42,7 @@ func area_entered(area):
parent.deal_damage(damage)
parent.freeze_modifier = freeze_modifier
parent.poison_damage = poison_damage
if ricochet_count >= bounced:
if bounced >= ricochet_count:
call_deferred("free")
choose_target()
bounced += 1

View File

@ -11,7 +11,7 @@ var shot = false
var sonic_wave
func _ready():
hp = 15
hp = 7
func _physics_process(delta):
if not shooting:

View File

@ -6,7 +6,7 @@ var speed = 24
func _ready():
randomize()
global_position = [Vector2(33, 50), Vector2(287, 70)][randi()%2]
hp = 15
hp = 7
func _physics_process(delta):
global_position = global_position.move_toward(player.global_position + Vector2(8, 8), speed * delta * speed_multiplier)

View File

@ -101,16 +101,19 @@ func _shoot():
bullet.freeze_modifier = freeze_modifier
bullet.poison_damage = poison_damage
bullet.speed_modifier = speed_modifier
bullet.ricochet_count = ricochet_count
get_parent().add_child(bullet)
bullet.global_position.x = self.global_position.x + 8
bullet.global_position.y = self.global_position.y + 8
bullet = fireball_preload.instance()
bullet.target = target
get_parent().add_child(bullet)
bullet.global_position.x = self.global_position.x + 8
bullet.global_position.y = self.global_position.y + 8
for i in range(fireball_amount):
var fireball = fireball_preload.instance()
fireball.target = target
get_parent().add_child(fireball)
fireball.global_position.x = self.global_position.x + 8
randomize()
fireball.global_position.y = self.global_position.y + 8 + randi()%8 - 4
func _draw():
if target != null and is_instance_valid(target) and not target.dead:

View File

@ -4,4 +4,4 @@ onready var player = get_tree().get_root().get_node("Game/View/Player")
var max_size = 80
func _process(delta):
$ColorRect.rect_size.x = max_size * (player.recharge_timer / player.get_recharge())
$ColorRect.rect_size.x = max_size * (clamp(player.recharge_timer, 0, player.get_recharge()) / player.get_recharge())