I've got to the point in my new game where I want to include Jamie's coding on running when holding down the control key, but I'm not sure if it's going to conflict with Colin's coding I use for climbing.
To save looking it up Jamie says that first you amend the HandlerPlayerUpdate in the handlers.gs file to:
// Custom movement test PlayerSet (P_CUSTOMMOVE, 1); CM_Update();
then add
Test_Ctrl();
to the start of the function CM_EnterKeyState() in movement.gs file.
Then add the following code to the bottom of movement.gs:
//////////////////////////////////
// tests if CTRL is being pressed (to walk fast)
/////////////////////////////////
func Test_Ctrl()
{
if (KeyboardStatus (0x1D) || KeyboardStatus (0x9D || JoystickStatus(3))
{ CM_STEPX=8; } //set walk speed to double
else { CM_STEPX=4; } // set walk speed to normal
}
For Colin's climbing code you add the Movement.2 file, which updates key states and starts:
#def CM2_STEPX 4 // move step x #def CM2_STEPY 2 // move step y; used in adjustments #def CM2_STEPYMAX 4 // move step y; used in jumps and falls #def CM2_BOXW 8 // collision box width #def CM2_BOXH 8 // collision box height
Also, the HandlerPlayerUpdate code in handlers.gs is changed to:
// Custom movement test
custommove = PlayerGet (P_CUSTOMMOVE);
if (custommove == 0) //engine default
{
PlayerSet(P_W, CM_BOXW);
PlayerSet(P_H, CM_BOXH);
}
else
if (custommove == 1) //scripted default
{
CM2_Update();
}
which I think would conflict with Jamies code in that script. Then of course the function in the game.gs file for climbing uses custom movement:
func LadderCollide()
{
PlayerSet (P_Y, PlayerGet (P_Y) -2);
PlayerSet(P_X, laddx);
if (PlayerGet (P_CUSTOMMOVE) == 0)
{
PlayerEnterScripted();
}
PlayerSet(P_TILE, 26);
scub = InventoryHasItem (ID_SCUBA);
if (scub == 1)
{
PlayerSet (P_TILE, 56);
}
WaitFrames (6);
PlayerSet (P_CUSTOMMOVE, 1);
CM2_EnterIdle();
}
So, I'm not really sure how to deal with this as I think it involves having to check for more than one custom move. Also, I would like the 'running' ability to only be available for a certain part of the game which hopefully could be turned off and on by a status check on a particular dynamic object.
Help please.
Grandad