Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | gameaddict24 |
I have a Ball scene and a separate Player scene. I want to check for collisions against any instance of the Player scene, but when I run the following code on the Ball’s KinematicBody2D:
var Player = preload("res://Player.tscn")
func _physics_process(delta):
col = move_and_collide(velocity)
if col and col.collider is Player:
print('hit player')
I get this error upon collision: Right operand of 'is' is not a class (type: 'PackedScene').
How do I get the class from a PackedScene? Am I going about this correctly?