size property

  1. @override
NotifyingVector2 size
override

The logical size of the component. The game assumes that this is the approximate size of the object that will be drawn on the screen. This size will therefore be used for collision detection and tap handling.

This property can be reassigned at runtime, although this is not recommended. Instead, in order to make the PositionComponent larger or smaller, change its scale.

Implementation

@override
NotifyingVector2 get size => _size;
  1. @override
void size=(Vector2 size)
override

Implementation

@override
set size(Vector2 size) {
  _size.setFrom(size);
  if (hasChildren) {
    children.forEach((child) => child.onParentResize(_size));
  }
}