I am currently trying to get the boss on my game to take damage from my character's blast and lose lives. Here is part of the script for the character's blast:
func physicsprocess(delta):
translate(velocity)
velocity.x = SPEED * delta * direction
$AnimatedSprite.play("shoot")
var bodies = getoverlappingbodies()
for b in bodies:
if b.isingroup("Enemy"):
b.queuefree()
for a in bodies:
if a.name == "BossEye":
Game.updateboss(-1) This part right here is the problem
queue_free()
Here is the part of the script for the boss for bosses' hearts:
onready var life = $"bosslives/Lives"
onready var Heartss = [$"bosslives/Lives/Sprite", "bosslives/Lives/Sprite2", "bosslives/Lives/Sprite3", "bosslives/Lives/Sprite4", "bosslives/Lives/Sprite5"]
var Bossheartfull = load("res://Assets/bob.png.png")
var Bosshearthalf = load("res://Assets/bob2.png.png")
var Bossheartempty = load("res://Assets/bob3.png.png")
var livess = 10
func updateboss(delta):
livess += delta
for a in range(len(Heartss)):
Heartss[a].texture = Bossheartfull
if livess < (a+1)*2:
Heartss[a].texture = Bossheartempty
if livess == (a*2)+1:
Heartss[a].texture = Bosshearthalf
if livess == 0:
gettree().change_scene("res://Scenes/WinScreen.tscn")