Fix Ricochet
parent
c513c48f8b
commit
4f32f718c6
|
@ -42,7 +42,7 @@ func area_entered(area):
|
||||||
parent.deal_damage(damage)
|
parent.deal_damage(damage)
|
||||||
parent.freeze_modifier = freeze_modifier
|
parent.freeze_modifier = freeze_modifier
|
||||||
parent.poison_damage = poison_damage
|
parent.poison_damage = poison_damage
|
||||||
if ricochet_count >= bounced:
|
if bounced >= ricochet_count:
|
||||||
call_deferred("free")
|
call_deferred("free")
|
||||||
choose_target()
|
choose_target()
|
||||||
bounced += 1
|
bounced += 1
|
||||||
|
|
|
@ -11,7 +11,7 @@ var shot = false
|
||||||
var sonic_wave
|
var sonic_wave
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
hp = 15
|
hp = 7
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
if not shooting:
|
if not shooting:
|
||||||
|
|
|
@ -6,7 +6,7 @@ var speed = 24
|
||||||
func _ready():
|
func _ready():
|
||||||
randomize()
|
randomize()
|
||||||
global_position = [Vector2(33, 50), Vector2(287, 70)][randi()%2]
|
global_position = [Vector2(33, 50), Vector2(287, 70)][randi()%2]
|
||||||
hp = 15
|
hp = 7
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
global_position = global_position.move_toward(player.global_position + Vector2(8, 8), speed * delta * speed_multiplier)
|
global_position = global_position.move_toward(player.global_position + Vector2(8, 8), speed * delta * speed_multiplier)
|
||||||
|
|
|
@ -101,16 +101,19 @@ func _shoot():
|
||||||
bullet.freeze_modifier = freeze_modifier
|
bullet.freeze_modifier = freeze_modifier
|
||||||
bullet.poison_damage = poison_damage
|
bullet.poison_damage = poison_damage
|
||||||
bullet.speed_modifier = speed_modifier
|
bullet.speed_modifier = speed_modifier
|
||||||
|
bullet.ricochet_count = ricochet_count
|
||||||
|
|
||||||
get_parent().add_child(bullet)
|
get_parent().add_child(bullet)
|
||||||
bullet.global_position.x = self.global_position.x + 8
|
bullet.global_position.x = self.global_position.x + 8
|
||||||
bullet.global_position.y = self.global_position.y + 8
|
bullet.global_position.y = self.global_position.y + 8
|
||||||
|
|
||||||
bullet = fireball_preload.instance()
|
for i in range(fireball_amount):
|
||||||
bullet.target = target
|
var fireball = fireball_preload.instance()
|
||||||
get_parent().add_child(bullet)
|
fireball.target = target
|
||||||
bullet.global_position.x = self.global_position.x + 8
|
get_parent().add_child(fireball)
|
||||||
bullet.global_position.y = self.global_position.y + 8
|
fireball.global_position.x = self.global_position.x + 8
|
||||||
|
randomize()
|
||||||
|
fireball.global_position.y = self.global_position.y + 8 + randi()%8 - 4
|
||||||
|
|
||||||
func _draw():
|
func _draw():
|
||||||
if target != null and is_instance_valid(target) and not target.dead:
|
if target != null and is_instance_valid(target) and not target.dead:
|
||||||
|
|
|
@ -4,4 +4,4 @@ onready var player = get_tree().get_root().get_node("Game/View/Player")
|
||||||
var max_size = 80
|
var max_size = 80
|
||||||
|
|
||||||
func _process(delta):
|
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())
|
||||||
|
|
Loading…
Reference in New Issue