I just made collision layers which are Player, Enemies and Powerups. The code I was using earlier was like this
if area.is_in_group("passthrough"):
$CollisionShape2D.set_deferred("disabled", true)
$PassThroughParticles.emitting = true
$PassThroughTimer.start()
Now I am assuming I don't need $CollisionShape2D.set_deferred("disabled", true)
part since I wont be disabling my collision shape. But I don't know how to use collision masks in code. Can you give an example considering I have now three different collision layers ?
Edit : I tried using set_collision_mask_bit(2,4)
after seeing the bit and value from the UI but maybe I messed up since after taking the powerup I still collide with enemies. Perhaps I have to do something to make the mask layer where enemies reside false ? If yes, then how can that be achieved ? Thank you very much for your help. BTW 2 and 4 are parameters for Powerup Mask layer.
Edit2: tried using set_collision_mask_bit(1,false)
. Still colliding with enemies