nodemules / SuperPlatformerBros

1 stars 0 forks source link

Enemy gravity is set incorrectly after death #40

Closed brenthaertlein closed 6 years ago

brenthaertlein commented 6 years ago

Enemy.cs:95

Change: Rigidbody.gravityScale = 10; to: Rigidbody.gravityScale *= 10;

brenthaertlein commented 6 years ago

Fixed a bug in the jumping behavior for Level 3

johngreedjr commented 6 years ago

This got messed up in #56

brenthaertlein commented 6 years ago

This should be fixed now. Since FlyFlys now have 0 gravityScale, they wouldn't fall at all with gravityScale *= 10.0f, which is how we erroneously ended up setting = 10.0f. This exposed the issue that there was "no way" to know the correct gravity scale (usually 1, but could be negative for upside down gravity or >1 for strong gravity).

I introduced a new field for all Enemy classes/subclasses called DeathGravityScale which defaults to 1 and is changed for all enemies on Level 3 to be -1.