hello.
I am creating a game where you receive falling objects (coins).
I am considering 2 ways to do this
- use add a force: apply a force at 90 degrees to the coins
- apply a PlatformerObject Behavior to the coins to make them fall with gravity and Max.Falling Speed
In case 1, the falling speed of the coins should all feel similar.
In case 2, the coins seem to accelerate as they fall, causing the gap to widen.
Which is more effective?
The platform character behavior seems to be overkill. You could create an object and add a permanent force.
If you wanted easing, you could use a Y position tween to the top of the platform. That way the coin would also stop automatically.
If there are multiple platforms then you could use
(150+Platform.BoundingBoxTop())/110 is used to set a consistent speed based on distance. You can add a random number if you want different speeds.
You could add another tween when the first tween ends that would fade the coin and delete it after a bit. Or maybe change the animation.
I like tweens because it just needs a couple of actions and then itβs automatic. Itβs all up to you.
2 Likes
Actually @Keith_1357 is right because if you want the coin to fall down gravity will be a better option as you can modify it
1 Like
Instead of adding an instant force, you could add a much smaller permanent force to acheive acceleration. You will need a much smaller number since these will stack up (maybe 7 px/s or less).
Alternatively you could also store the speed in a variable and increase it over time, but this would be less organized and I would only do that if I really needed it for other reasons.
However, Tween is probably the most performant option if you donβt need to access the speed or force of the coin somewhere else. You could even use Bounce easing to have the coin bounce off the ground without any collision detection! (Of course, you will need to know the exact Y position to bounce from)
2 Likes