Class StatefulPlayerCharacter
- All Implemented Interfaces:
FrameUpdateListener,FrameUpdateListenerRegistration,KeyStrokeListener,KeyStrokeListenerRegistration,MouseClickListenerRegistration,MouseScrollListenerRegistration
public class StatefulPlayerCharacter
extends StatefulAnimation<PlayerState>
implements KeyStrokeListener, FrameUpdateListener
-
Field Summary
Fields inherited from class pi.actor.StatefulAnimation
frameDuration, height, width -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonFrameUpdate(double dT) Diese Methode wird bei einem (angemeldeten) Objekt bei jedem Einzelbild erneut aufgerufen.voidWird bei einem angemeldeten Beobachter aufgerufen, sobald eine Taste gedrückt wird.Methods inherited from class pi.actor.StatefulAnimation
addState, animationPaused, changeState, flipHorizontal, flipVertical, frameDuration, hasState, height, isAnimationPaused, isFlipHorizontal, isFlipVertical, size, state, state, stateTransition, widthMethods inherited from class pi.actor.Actor
addCollisionListener, addCollisionListener, addCollisionListener, addMountListener, addUnmountListener, anchor, anchor, anchor, anchorformatted, angularDamping, angularDamping, angularVelocity, angularVelocity, animateOpacity, animateParticle, applyForce, applyForce, applyForce, applyImpulse, applyImpulse, applyImpulse, applyRotationImpulse, applyTorque, awake, bodyType, bodyType, center, center, center, centerRelative, collisions, color, color, color, complementaryColor, contains, createDistanceJoint, createPrismaticJoint, createRevoluteJoint, createRopeJoint, createWeldJoint, density, density, fixture, fixtures, fixtures, frameUpdateListeners, friction, friction, gravityScale, gravityScale, hide, isGrounded, isMounted, isRotationLocked, isVisible, keyStrokeListeners, layer, layerPosition, layerPosition, linearDamping, linearDamping, listenerBundle, lockRotation, makeDynamic, makeKinematic, makeParticle, makeSensor, makeStatic, mass, mouseClickListeners, mouseScrollListeners, moveBy, moveBy, opacity, opacity, overlaps, remove, removeMountListener, removeUnmountListener, resetMovement, restitution, restitution, rotateBy, rotation, rotation, rotationLocked, show, sleep, toggleVisible, velocity, velocity, visible, x, x, y, yMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface pi.event.FrameUpdateListenerRegistration
addFrameUpdateListener, defer, delay, removeFrameUpdateListener, repeat, repeat, repeat, repeat, repeatMethods inherited from interface pi.event.KeyStrokeListener
onKeyUpMethods inherited from interface pi.event.KeyStrokeListenerRegistration
addKeyStrokeListener, removeKeyStrokeListenerMethods inherited from interface pi.event.MouseClickListenerRegistration
addMouseClickListener, removeMouseClickListenerMethods inherited from interface pi.event.MouseScrollListenerRegistration
addMouseScrollListener, removeMouseScrollListener
-
Constructor Details
-
StatefulPlayerCharacter
public StatefulPlayerCharacter()
-
-
Method Details
-
onKeyDown
Description copied from interface:KeyStrokeListenerWird bei einem angemeldeten Beobachter aufgerufen, sobald eine Taste gedrückt wird. Die Methode wird erst dann wieder aufgerufen, wenn die Taste losgelassen und erneut gedrückt wurde.@Override public void onKeyDown(KeyEvent event) { switch (event.getKeyCode()) { case KeyEvent.VK_UP: circle.moveBy(0, 1); break; case KeyEvent.VK_RIGHT: circle.moveBy(1, 0); break; } }- Specified by:
onKeyDownin interfaceKeyStrokeListener- Parameters:
keyEvent- EinKeyEvent-Objekt, das Informationen enthält, welche Taste gedrückt würde. Die Tastennummer kann zum Beispiel über die Methodeevent.getKeyCode()abgefragt werden.
-
onFrameUpdate
public void onFrameUpdate(double dT) Description copied from interface:FrameUpdateListenerDiese Methode wird bei einem (angemeldeten) Objekt bei jedem Einzelbild erneut aufgerufen.- Specified by:
onFrameUpdatein interfaceFrameUpdateListener- Parameters:
dT- Die Zeit in Sekunden, die seit der letzten Aktualisierung vergangen ist.
-