Open willnationsdev opened 5 years ago
This actually quite complex because you would want a Pickup to derive different things depending on what behavior you'd like it to have. Assuming that, no matter what, you had a child Area2D with a CollisionShape2D to do the collision detection, you'd still have the option of extending Sprite, StaticBody2D, KinematicBody2D, and Rigidbody2D based on how much physical presence and maneuverability you want the Pickup to have. There's then also the optional presence of ParticleSystem, AnimationPlayer, and/or AudioStreamPlayer nodes to supplement the pickup effects / movement behavior.
All in all, creating a single script that fulfills all use-cases' functionality isn't really feasible. Instead, we'd have to just go with a compromise that meets MOST use cases that has more functionality, and then toggles off the features that aren't needed for a particular use-case. Like making a KinematicBody2D that employs the features, but exposes properties to turn off the collision / physical presence stuff.
Add a Pickup node that easily lets you create various types of property-modifying game collectables (health orbs, money, etc.).