public class Player
extends Actor
fitHeightProperty, fitWidthProperty, imageProperty, preserveRatioProperty, smoothProperty, viewportProperty, xProperty, yProperty
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, cacheHintProperty, cacheProperty, clipProperty, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, focusedProperty, focusTraversableProperty, hoverProperty, idProperty, impl_showMnemonicsProperty, impl_treeVisibleProperty, inputMethodRequestsProperty, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParentTransformProperty, localToSceneTransformProperty, managedProperty, mouseTransparentProperty, nodeOrientationProperty, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, pickOnBoundsProperty, pressedProperty, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, styleProperty, translateXProperty, translateYProperty, translateZProperty, visibleProperty
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.ConcurrentLinkedQueue<PlayerAction> |
actionQueue |
private PlayerAction |
comboAction |
private java.util.Map<java.lang.String,ComboSet> |
comboSet |
private PlayerAction |
continuousAction |
private java.util.Map<javafx.scene.input.KeyCode,PlayerAction> |
controlKeys |
private boolean |
covering |
private ComboSet |
currentSet |
private boolean |
facingRight |
private int |
health |
private boolean |
isCurrHurt |
private java.lang.String |
name |
private int |
numCombo |
private int |
numHit |
private int |
posInCombo |
private long |
prev |
private PlayerAction |
singleAction |
private int |
xStart |
private int |
yStart |
Constructor and Description |
---|
Player(java.lang.String name,
java.util.Map<java.lang.String,ComboSet> combos,
int x,
int y,
java.util.Map<javafx.scene.input.KeyCode,PlayerAction> controlK) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
act(long now) |
void |
addAction(javafx.scene.input.KeyCode k)
Adds the action based on the KeyCode input if the action based on the
control keys is not null, the continuous action attribute gets set
to the action if it is null otherwise the actions are added to the
queue to get processed later.
|
void |
advanceFrame(ComboSet currSet,
long now,
boolean isSingleAction)
Determines the next act step for the player
|
void |
cancelAction(javafx.scene.input.KeyCode k)
Cancels the action only if it is a continuous action e.g.
|
void |
changeX(double d)
Makes constraints for the player as to where it can move
prevents the player from going outside the map
|
int |
getCombo() |
ComboSet |
getCurrSet() |
int |
getHealth() |
java.lang.String |
getName() |
int |
getPosInCombo() |
boolean |
isCovering() |
boolean |
isCurrHurt() |
boolean |
isFacingRight() |
void |
resetAllPosExcept(java.lang.String name)
Resets all of the positions in the hash map of ComboSets to 0 except
the specified or null if all of them should be reset
|
void |
setCombo(int numCombo) |
void |
setCovering(boolean covering) |
void |
setCurrHurt(boolean isCurrHurt) |
void |
setFacingRight(boolean facingRight) |
void |
setHealth(int health) |
void |
setName(java.lang.String name) |
void |
setPosInCombo(int n) |
void |
setSingleAction(PlayerAction p) |
getHeight, getIntersectingObjects, getOneIntersectingObject, getWidth, getWorld, move
fitHeightProperty, fitWidthProperty, getClassCssMetaData, getCssMetaData, getFitHeight, getFitWidth, getImage, getViewport, getX, getY, imageProperty, impl_computeContains, impl_computeGeomBounds, impl_createPeer, impl_processMXNode, impl_updatePeer, isPreserveRatio, isSmooth, preserveRatioProperty, setFitHeight, setFitWidth, setImage, setPreserveRatio, setSmooth, setViewport, setX, setY, smoothProperty, viewportProperty, xProperty, yProperty
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_computeLayoutBounds, impl_cssGetCursorInitialValue, impl_cssGetFocusTraversableInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_notifyLayoutBoundsChanged, impl_pickNode, impl_pickNodeLocal, impl_processCSS, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isResizable, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, maxHeight, maxWidth, minHeight, minWidth, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, prefHeight, prefWidth, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, resize, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
private int health
private java.lang.String name
private int numCombo
private java.util.Map<java.lang.String,ComboSet> comboSet
private boolean facingRight
private int posInCombo
private long prev
private int numHit
private int xStart
private int yStart
private java.util.Map<javafx.scene.input.KeyCode,PlayerAction> controlKeys
private PlayerAction continuousAction
private PlayerAction singleAction
private PlayerAction comboAction
private java.util.concurrent.ConcurrentLinkedQueue<PlayerAction> actionQueue
private ComboSet currentSet
private boolean covering
private boolean isCurrHurt
public Player(java.lang.String name, java.util.Map<java.lang.String,ComboSet> combos, int x, int y, java.util.Map<javafx.scene.input.KeyCode,PlayerAction> controlK)
public void addAction(javafx.scene.input.KeyCode k)
k
- is the KeyCodepublic void cancelAction(javafx.scene.input.KeyCode k)
k
- is the KeyCodevoid act(long now)
act
in class Actor
public void advanceFrame(ComboSet currSet, long now, boolean isSingleAction)
currSet
- is the current comboSet the player is acting outnow
- is the current timeisSingleAction
- is if the current action being processed is a single action or a combopublic boolean isFacingRight()
public int getHealth()
public void changeX(double d)
d
- is the current X position of the player plus the distance to movepublic void resetAllPosExcept(java.lang.String name)
name
- is the name of the specified ComboSet to not be reset
null should be input if all of them are to be resetpublic void setSingleAction(PlayerAction p)
public void setHealth(int health)
public void setFacingRight(boolean facingRight)
public int getCombo()
public void setCombo(int numCombo)
public int getPosInCombo()
public void setPosInCombo(int n)
public ComboSet getCurrSet()
public boolean isCovering()
public void setCovering(boolean covering)
public boolean isCurrHurt()
public void setCurrHurt(boolean isCurrHurt)
public java.lang.String getName()
public void setName(java.lang.String name)