Hi all,
Working on game 4. The arkanoid / breakout clone.
I have a "Gun Bat" and it works well, UNTIL the bullet object hits the last brick object. I then get the following error:
Invalid call. Nonexistent function 'get_nodes_in_group' in base 'KinematicBody2D (bullet.gd)'.
Here is the code leading up to that point in the bullet script:
#find out if we hit a brick
if is_colliding():
var entity = get_collider()
if entity.get_parent().is_in_group("bricks"):
#destroy the brick
entity.get_parent().destroyThisBrick()
#destroy ourselves
queue_free()
#check if the level is over or not (we shot the last brick)
if get_tree().get_nodes_in_group("bricks").size() <= 1:
#show the congrats scene
get_node("/root/gameLevel/levelFinished").showScene()
get_node("/root/gameLevel/levelFinished").updateLabels()
#remove any leftover balls
###################################################
#THIS IS THE BUG, BELOW, FOR SHOOTING THE LAST BRICK AND IT FAILING
###################################################
if self.is_inside_tree():
if get_tree().get_nodes_in_group("balls").size() >= 1:
var ballList = get_nodes_in_group("balls")
#/\ Above is the line it errors on /\
for i in ballList:
i.queue_free()
I'm a little confused on this. Any advice would be very much appreciated.