MCPcopy
hub / github.com/4ian/GDevelop / OnLadder

Class OnLadder

Extensions/PlatformBehavior/platformerobjectruntimebehavior.ts:2507–2564  ·  view source on GitHub ↗

* The object grabbed a ladder. It can stand or move in 8 directions.

Source from the content-addressed store, hash-verified

2505 * The object grabbed a ladder. It can stand or move in 8 directions.
2506 */
2507 class OnLadder implements State {
2508 private _behavior: PlatformerObjectRuntimeBehavior;
2509
2510 constructor(behavior: PlatformerObjectRuntimeBehavior) {
2511 this._behavior = behavior;
2512 }
2513
2514 enter() {
2515 this._behavior._canJump = true;
2516 this._behavior._currentFallSpeed = 0;
2517 }
2518
2519 leave() {}
2520
2521 beforeUpdatingObstacles(timeDelta: float) {}
2522
2523 checkTransitionBeforeX() {}
2524
2525 beforeMovingX() {}
2526
2527 checkTransitionBeforeY(timeDelta: float) {
2528 const behavior = this._behavior;
2529 //Coming to an extremity of a ladder
2530 if (!behavior._isOverlappingLadder()) {
2531 behavior._setFalling();
2532 }
2533
2534 //Jumping
2535 behavior._checkTransitionJumping();
2536
2537 //Release the ladder
2538 if (behavior._releaseLadderKey) {
2539 behavior._releaseLadder();
2540 }
2541 }
2542
2543 beforeMovingY(timeDelta: float, oldX: float) {
2544 const behavior = this._behavior;
2545
2546 // TODO: we could consider supporting acceleration for ladder climbing in the future.
2547 if (behavior._upKey) {
2548 behavior._requestedDeltaY -= behavior._ladderClimbingSpeed * timeDelta;
2549 }
2550 if (behavior._downKey) {
2551 behavior._requestedDeltaY += behavior._ladderClimbingSpeed * timeDelta;
2552 }
2553 }
2554
2555 getNetworkSyncData(): OnLadderStateNetworkSyncData {
2556 return {};
2557 }
2558
2559 updateFromNetworkSyncData(data: OnLadderStateNetworkSyncData) {}
2560
2561 toString(): String {
2562 return 'OnLadder';
2563 }
2564 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected