Topic was automatically imported from the old Question2Answer platform.
Asked By
Duhan BALCI
I want to change collision mask’s and layers dynamicly with gdscript.A script attached to kinematic2d node.I cant use set_collision_layer_bit function in script.I’m getting an error
The method “set_collision_layer_bit” isn’t declared in the current class
How can i use set_collision_layer_bit function in kinematicbody2d ?
set_collision_layer_bit() is a method of the class KinematicBody2D
Make sure the method is called from your KinematicBody2D.
The error The method “set_collision_layer_bit” isn’t declared in the current class means you are not calling this method from an object that is KinematicBody2D.
Thank you! I was changed node type from Node2D to KinematicBody2D.But the first line of the script still “extends Node2D”.I chanced it too.