Game Development Community

Ladder object

by Harrison Brock · in TGB Platformer Kit · 03/13/2008 (3:07 pm) · 2 replies

Hello,

I'm able to make a object work as a rope(going up/down). But I'm not able to make it work as a ladder. As when you get to the top of the ladder you can walk on the platformer.

#1
03/13/2008 (4:36 pm)
Go to the "ActorBehavior::updateClimbing()" function inside the "game/behaviors/ActorBehavior.cs" file.

Find and comment out these lines:

// If we're above the top of the ladder, clamp our position
if (%actorMin < %ladderMin)
    %this.Owner.setPositionY(%ladderMin - %this.MaskMin.Y);

Then find the function "ActorBehavior::updateOnLadderPhysics()" in the same document.

Find and comment out these lines:

// Make sure we're not trying to move above the top of the ladder
%playerTop = %this.Owner.Position.Y + %this.MaskMin.Y + %this.MoveSpeed.Y * $Tick;
%ladderTop = %this.LadderObject.Position.Y - %this.LadderObject.Size.Y / 2;
if (%playerTop < %ladderTop)
    %this.MoveSpeed.Y  = 0;

This should allow you to move above the top of the ladder. Let me know how you get on.
#2
03/13/2008 (6:05 pm)
Hey Philip thanks. That works.