Howdy hey again.

Is this code no longer valid in Godot 4's GDscript? "$CollisionShape2D.shape.get_extents()"

You see, I'm trying to flip my RayCast2D to the other side of my enemy's collision box shape (I was pasting over code from an older tutorial to make my enemy behave like a red koopa troopa by saying "$RayCast2D.position.x = $CollisionShape2D.shape.get_extents().x * direction"

But I keep getting an error saying "Invalid call. Nonexistent function 'get_extents' in base 'RectangleShape2D'

Is this a new thing in Godot 4, or should is my project/code the problem?
(if it's necessary to upload my project/code, can someone tell me how?)

TwistedTwigleg

I used $CollisionShape2D.shape.get_size().x * direction which made my enemy turn around, but it made the floor checker (Raycast2D) move too far to the other side horizontally, outside the collision shape.

I also tried $CollisionShape2D.shape.get_rect().x * direction and that didn't work.

    NJL64 Looking at the docs it seems get_rect() returns a Rect2D which in itself has several methods. Maybe trying calling get_area or one of the other methods.