public void cleanUpMovementList() { //System.Console.WriteLine("Cleaning up movement list"); int listCount = movementList.Values.Count; for (int i = 0; i < listCount; i++) { //System.Console.WriteLine("Iterating through movementlist"); if (((MovementMessage)movementList.GetByIndex(i)).messageTerminated == true) { MovementMessage message = ((MovementMessage)movementList.GetByIndex(i)); String messageTypeId = message.messageTypeId; Character2D character = game.getSceneGraph().getGenericCharacter2D(message.objectId); ////System.Console.WriteLine("Removing terminated message: " + message.messageTypeId); movementList.RemoveAt(i); if (messageTypeId.Equals(GameConstants.PLAYER_INITIAL_JUMP_MSG)) { System.Console.WriteLine("Triggering fall message after cleanup"); //character.changeStatus(GameConstants.PLAYER_FALL_MSG); } else if (messageTypeId.Equals(GameConstants.PLAYER_INITIAL_JUMP_MOVING_LEFT_MSG)) { ////System.Console.WriteLine("Triggering fall message after cleanup"); character.changeStatus(GameConstants.PLAYER_FALL_MOVING_LEFT_MSG); } else if (messageTypeId.Equals(GameConstants.PLAYER_INITIAL_JUMP_MOVING_RIGHT_MSG)) { //System.Console.WriteLine("Triggering fall message after cleanup"); character.changeStatus(GameConstants.PLAYER_FALL_MOVING_RIGHT_MSG); } } } }
public void gravityHandler(Character2D character) { if (!isCollidingWithFloor(character.objectPosition, character.width, character.height)) { //System.Console.WriteLine("Gravity Handler: changing status to falling"); character.changeStatus(GameConstants.PLAYER_FALL_MSG); } else { Console.WriteLine("Gravity collision"); } }