Class UserControlledShooter
- java.lang.Object
-
- com.badlogic.gdx.graphics.g3d.Renderable
-
- com.bombinggames.wurfelengine.core.gameobjects.AbstractGameObject
-
- com.bombinggames.wurfelengine.core.gameobjects.AbstractEntity
-
- com.bombinggames.wurfelengine.core.gameobjects.MovableEntity
-
- com.bombinggames.wurfelengine.extension.UserControlledShooter
-
- All Implemented Interfaces:
Controllable
public class UserControlledShooter extends MovableEntity implements Controllable
The UserControlledShooter is a character who can walk and shoot.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractEntity
colissionRadius
-
Fields inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractGameObject
sprite
-
-
Constructor Summary
Constructors Constructor Description UserControlledShooter(int spritesPerDir, int height)
Creates a player.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
equipWeapon(Weapon weapon)
Gives the player a weapon.com.badlogic.gdx.math.Vector3
getAiming()
Getting aim relative to middle of view by reading mouse position.Camera
getCamera()
Get the camera used to identify the aiming direction.Weapon
getWeapon()
void
jump()
Jumps the player with a soundvoid
setCamera(Camera camera)
Set the camera which is renderin the player to calculate the aiming.UserControlledShooter
spawn(Point point)
Add this entity to the map-> let it spawnvoid
update(float dt)
Updates the character.void
walk(boolean up, boolean down, boolean left, boolean right, float walkingspeed, float dt)
Lets the object walk.-
Methods inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractEntity
addComponent, collidesWith, getCollidingEntities, getCollidingEntities, getComponents, getComponents, getCoord, getCoveredBlocks, getDimensionZ, getHealth, getLightlevelB, getLightlevelG, getLightlevelR, getMass, getName, getPoint, getPosition, getRegisteredEntities, getSpriteCategory, getSpriteId, getSpriteValue, hasPosition, heal, isIndestructible, isInMemoryArea, isMarkedDS, isSavedPersistent, markAsVisitedDS, registerEngineEntities, registerEntity, removeComponent, removeFromMap, requestChunk, setDamageSounds, setDimensionZ, setHealth, setIndestructible, setLightlevel, setMass, setName, setPosition, setPosition, setSavePersistent, setSpriteCategory, setSpriteId, setSpriteValue, setUseRawDelta, shouldBeDisposed, takeDamage, useRawDelta
-
Methods inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractGameObject
getColor, getDepth, getPixmap, getRotation, getScaling, getSprite, getSprite, getSpritesheet, getSpritesheetPath, getTextureDiffuse, getTextureNormal, isHidden, loadSheet, render, render, setColor, setCustomSpritesheet, setHidden, setRotation, setScaling, shouldBeRendered, staticDispose, updateSpriteCache
-
Methods inherited from class com.bombinggames.wurfelengine.core.gameobjects.MovableEntity
addMovement, addMovement, addMovement, addToHor, collidesWithWorld, dispose, getFriction, getMovement, getMovementHor, getOrientation, getSpeed, getSpeedHor, handleMessage, isColiding, isFloating, isInLiquid, isOnCeil, isOnGround, jump, pauseMovementAnimation, playMovementAnimation, setColiding, setContinuousWalkingAnimation, setFallingSound, setFloating, setFriction, setHorMovement, setJumpingSound, setMovement, setMovement, setOrientation, setRunningSound, setSpeedHorizontal, setSpeedIncludingZ, setStepSound1Grass, setWalkingAnimationCycling, setWalkingStepMode, setWaterSound, step, updateSprite
-
-
-
-
Method Detail
-
spawn
public UserControlledShooter spawn(Point point)
Description copied from class:AbstractEntity
Add this entity to the map-> let it spawn- Overrides:
spawn
in classMovableEntity
- Parameters:
point
- the point in the game world where the object is. If it was previously set this is ignored.- Returns:
- returns itself
-
walk
public void walk(boolean up, boolean down, boolean left, boolean right, float walkingspeed, float dt)
Description copied from interface:Controllable
Lets the object walk. Replaces the horizontal movement.- Specified by:
walk
in interfaceControllable
- Parameters:
up
- move up?down
- move down?left
- move left?right
- move right?walkingspeed
- the higher the speed the bigger the steps. Should be in m/s.
-
jump
public void jump()
Jumps the player with a sound- Overrides:
jump
in classMovableEntity
- See Also:
MovableEntity.jump(float, boolean)
-
getAiming
public com.badlogic.gdx.math.Vector3 getAiming()
Getting aim relative to middle of view by reading mouse position. If no camera is configured dircetion of head.- Overrides:
getAiming
in classMovableEntity
- Returns:
-
update
public void update(float dt)
Description copied from class:MovableEntity
Updates the character. Applies gravitation.- Overrides:
update
in classMovableEntity
- Parameters:
dt
- time since last update in ms
-
setCamera
public void setCamera(Camera camera)
Set the camera which is renderin the player to calculate the aiming. If camera is null- Parameters:
camera
-
-
getCamera
public Camera getCamera()
Get the camera used to identify the aiming direction.- Returns:
-
getWeapon
public Weapon getWeapon()
- Returns:
-
equipWeapon
public void equipWeapon(Weapon weapon)
Gives the player a weapon. Reloads if not loaded.- Parameters:
weapon
-
-
-