Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Gary_CHAN |
I have an Area2D as Scene Root and a CollisioinShape2D called Shape as a child. I added a RectangleShape2D as the shape of the CollisioinShape2D .
When I try to set the extend of the RectangleShape2D, it shows "Invalid set index ‘extends’ (on base: ‘RectangleShape2D’) with value of type 'Vector2’ "
if I use set_extends( Vector2(1, 1) ), it shows "Invalid call. Nonexistent function ‘set_extends’ in base 'RectangleShape2D’ "
I checked the type of extends is Vector2 and I don’t know which part I did wrong.
my code is like this:
extends Area2D
var width = 10
var height = 10
func _ready():
get_node("Shape").shape.extends( Vector2(width, height) )