GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

[Platformer] Fix the platformer object small movement when it is on a platform at startup

Open D8H opened this issue 3 years ago • 1 comments

Edit: This no longer fix any unit test, it's probably not useful.

Note: this is extracted from: https://github.com/4ian/GDevelop/pull/2574 and commited over https://github.com/4ian/GDevelop/pull/2602

Context

  • This is the issue reported here: https://github.com/4ian/GDevelop/issues/2562
  • At the 1st frame
  • The platformer object is on a platform
  • The intial state is always Falling

Actual

  • There is no transition from Falling to OnFloor possible before the movement is applied.
  • The platformer object falls for one 1 frame and transition to OnFloor after moving.
HeadlessChrome 90.0.4430 (Windows 10.0.0) gdjs.PlatformerObjectRuntimeBehavior (falling) must not move when on the floor at startup FAILED
        Error: expected -31 to equal -30
            at Assertion.assert (node_modules/expect.js/index.js:96:13)
            at Assertion.be.Assertion.equal (node_modules/expect.js/index.js:216:10)
            at Assertion.<computed> [as be] (node_modules/expect.js/index.js:69:24)
            at context.<anonymous> (GDevelop/Extensions/PlatformBehavior/tests/platformerobjectruntimebehavior.spec.js:159:34)

Expected

  • It transitions to Onfloor before moving.
  • The position stays the same.

Context

  • The platformer object is on a platform.
  • This platform is teleported over it's top without any contact.
  • For instance, this could happens in a game when the player must go up jumping on a jumpthru that teleports up in sequence.

Actual

  • The transition from Onfloor to Falling before moving only uses the spacial search without collision test.
  • The platformer object follows the platform.
HeadlessChrome 90.0.4430 (Windows 10.0.0) gdjs.PlatformerObjectRuntimeBehavior (rounded coordinates, moving platforms) must not follow a platform that is moved over its top FAILED
        Error: expected true to equal false
            at Assertion.assert (node_modules/expect.js/index.js:96:13)
            at Assertion.be.Assertion.equal (node_modules/expect.js/index.js:216:10)
            at Assertion.<computed> [as be] (node_modules/expect.js/index.js:69:24)
            at context.<anonymous> (GDevelop/Extensions/PlatformBehavior/tests/platformerobjectruntimebehavior.spec.js:960:58)

Expected

  • The platformer object doesn't follow the platform.

D8H avatar May 02 '21 18:05 D8H