I'm using the default KeyboardMovement script, and am completely stumped. This is for an arcade-style game that I'm working on as a side project.
The player facing down.
The Goal:
1. The player will use the left/right arrow keys to cycle through views. If facing down, then by pressing left arrow key, he would shift to the Southwest view. If facing Southwest, then by pressing the left arrow key, the character would now be facing Left. The same principle would apply by pressing the right arrow key. If you press the up arrow key, then the player begins walking in the current direction assigned by the left or right arrow keys (whether northeast, left, right, etc.).
2. I don't want the character to automatically move when an arrow is pressed. The only arrow for movement will be the up arrow. Keep in mind that the character is sitting in a chair, so the only way to move backwards would be via the spacebar (to kick).
3. The character shouldn't stop immediately after letting go of the up button. It should be a slow, gradual halt.
To clarify a bit, I want it where the left arrow will always rotate the character clockwise, while the right arrow would always rotate counter-clockwise. You move forward by pressing the up arrow, which moves you straight towards any direction you're facting (even down). I would program in the spacebar to cause the player to kick and propel himself backwards on the chair. Essentially, this makes it more ideal to travel backwards (you move much faster).
The obvious code changes so far:
Code: AGS
Semi-working Globalscript code (tweaked slightly)
Code: AGS
Other failed ideas (This time in the KeyboardMovement_102 Script)
Code: AGS
Any thoughts or simple tricks to achieving this movement scheme? Thanks in advance!
The player facing down.
The Goal:
1. The player will use the left/right arrow keys to cycle through views. If facing down, then by pressing left arrow key, he would shift to the Southwest view. If facing Southwest, then by pressing the left arrow key, the character would now be facing Left. The same principle would apply by pressing the right arrow key. If you press the up arrow key, then the player begins walking in the current direction assigned by the left or right arrow keys (whether northeast, left, right, etc.).
2. I don't want the character to automatically move when an arrow is pressed. The only arrow for movement will be the up arrow. Keep in mind that the character is sitting in a chair, so the only way to move backwards would be via the spacebar (to kick).
3. The character shouldn't stop immediately after letting go of the up button. It should be a slow, gradual halt.
To clarify a bit, I want it where the left arrow will always rotate the character clockwise, while the right arrow would always rotate counter-clockwise. You move forward by pressing the up arrow, which moves you straight towards any direction you're facting (even down). I would program in the spacebar to cause the player to kick and propel himself backwards on the chair. Essentially, this makes it more ideal to travel backwards (you move much faster).
The obvious code changes so far:
//Solves the automatic movement.
KeyboardMovement.SetMode(eKeyboardMovement_Pressing);
Semi-working Globalscript code (tweaked slightly)
//View 0 is Down, View 6 is Southwest, View 1 is Left
if(Jerry.Loop == 0 && IsKeyPressed(eKeyLeftArrow))
Jerry.FaceLocation(player.x - 50, player.y + 50);
if(Jerry.Loop == 6 && IsKeyPressed(eKeyLeftArrow))
Jerry.FaceLocation(player.x - 50, player.y);
if(Jerry.Loop == 1 && IsKeyPressed(eKeyRightArrow))
Jerry.FaceLocation(player.x - 50, player.y + 50);
Other failed ideas (This time in the KeyboardMovement_102 Script)
else if (IsKeyPressed(KeyboardMovement_KeyLeft) && Jerry.Loop == 0) newdirection = eKeyboardMovement_DownLeft; // Moves DownLeft (If Down)
else if (IsKeyPressed(KeyboardMovement_KeyLeft) && Jerry.Loop == 6) newdirection = eKeyboardMovement_Left; // Moves Left (If DownLeft)
else if (IsKeyPressed(KeyboardMovement_KeyLeft) && Jerry.Loop == 1) newdirection = eKeyboardMovement_UpLeft; // Moves UpLeft (If Left)
else if (IsKeyPressed(KeyboardMovement_KeyLeft) && Jerry.Loop == 7) newdirection = eKeyboardMovement_Up; // Moves Up (If UpLeft)
else if (IsKeyPressed(KeyboardMovement_KeyLeft) && Jerry.Loop == 3) newdirection = eKeyboardMovement_UpRight; // Moves UpRight (If Up)
else if (IsKeyPressed(KeyboardMovement_KeyRight) && Jerry.Loop == 0) newdirection = eKeyboardMovement_DownRight; // Moves DownRight (If Down)
else if (IsKeyPressed(KeyboardMovement_KeyRight) && Jerry.Loop == 6) newdirection = eKeyboardMovement_Down; // Moves Down (If DownLeft)
else if (IsKeyPressed(KeyboardMovement_KeyRight) && Jerry.Loop == 1) newdirection = eKeyboardMovement_DownLeft; // Moves Down (If DownLeft)
Any thoughts or simple tricks to achieving this movement scheme? Thanks in advance!