Hi New to Godot
When I resize a PoolVector2Array to Zero it cause "Invalid call. Nonexistent function 'size in base 'Nil'"
which is fine but I am not sure that if that is the correct behaviour as when I declare the variable it has a size of 0 and the size function reports that. So one would have liked the resize function to resize a PoolVector2Array to 0 but not destroy the Array.
My Code for Refrence
godot v3.0.6.stable
extends Node2D
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var ArrayOf2D = PoolVector2Array()
var ArrayOf2D_2 = PoolVector2Array([Vector2(0,0),Vector2(10,10),Vector2(20,20),Vector2(30,30)])
func _ready():
# Called when the node is added to the scene for the first time.
# Initialization here
#draw_line(Vector2(0,0),Vector2(0.1,0.1),Color(255,0,0),1)
pass
#func _process(delta):
# # Called every frame. Delta is time since last frame.
# # Update game logic here.
# pass
func _draw():
draw_polyline(ArrayOf2D,Color(255,0,0),1)
draw_polyline(ArrayOf2D_2,Color(255,100,0),1)
pass
func _input(event):
if event is InputEventMouseMotion:
if Input.is_mouse_button_pressed(BUTTON_LEFT):
print("Mouse Motion at:",event.position)
print("Mouse Relitive at:",event.relative)
print("Mouse Speed at:",event.speed)
print("Array size :",ArrayOf2D.size())
ArrayOf2D.append(event.position)
update()
if event is InputEventMouseButton:
if (event.button_index == BUTTON_LEFT and not event.is_pressed()):
** ArrayOf2D = ArrayOf2D.resize(0)**