public class Walker extends DynamicBody
Constructor and Description |
---|
Walker(World world)
Initialise a new Walker with no attached shapes.
|
Walker(World world,
Shape shape)
Initialise a new dynamic Walker with a single shape attached.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Remove this body from the world and notify all registered
DestructionListener s. |
void |
jump(float speed)
Jump upwards with a given initial speed, after which gravity takes over.
|
void |
startWalking(float speed)
Start continually setting the horizontal speed of the body,
or change the speed if we are already walking.
|
void |
stopWalking()
Stop continually setting the horizontal speed of the body.
|
applyForce, applyForce, applyImpulse, applyImpulse, applyTorque, getGravityScale, isBullet, setAngularVelocity, setBullet, setGravityScale, setLinearVelocity
addCollisionListener, addDestructionListener, addImage, contains, getAngle, getAngleDegrees, getAngularVelocity, getBodiesInContact, getFillColor, getFixtureList, getImages, getLinearVelocity, getLineColor, getMass, getName, getPosition, getWorld, intersects, intersects, isAlwaysOutline, isClipped, move, putOn, putOn, removeAllCollisionListeners, removeAllDestructionListeners, removeAllImages, removeAttachedImage, removeCollisionListener, removeDestructionListener, rotate, rotate, rotateDegrees, rotateDegrees, setAlwaysOutline, setAngle, setAngleDegrees, setClipped, setFillColor, setLineColor, setName, setPosition, toString
public Walker(World world)
world
- the world in which this body will existpublic Walker(World world, Shape shape)
world
- the world in which this body will existshape
- the initial shape of this bodypublic void jump(float speed)
speed
- the initial vertical speedpublic void startWalking(float speed)
speed
- the horizontal speed (positive to move right, negative to move left)public void stopWalking()
public void destroy()
Body
DestructionListener
s.
Destruction listeners are notified immediately (before any additional
cleanup actions are performed and before the body is removed from the
World
).
This body must not be accessed after being destroyed.