Package fr.formiko.kokcinelo.view
Class MapItemActor
java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
com.esotericsoftware.spine.utils.SkeletonActor
fr.formiko.kokcinelo.view.MapItemActor
public class MapItemActor
extends com.esotericsoftware.spine.utils.SkeletonActor
Actor that represent a MapItem.
- Since:
- 0.1
- Version:
- 1.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Stores information needed by the view for a character state. -
Constructor Summary
ConstructorsConstructorDescriptionMapItemActor
(MapItem mapItem, int width, int height) Secondary constructor with a null texture but a fix size.MapItemActor
(String textureName, MapItem mapItem) Main constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
act
(float delta) Update this actor.void
Animate the creature.void
draw
(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha) Draw this actor texture and if showZone draw all debug info.void
drawDebugCircles
(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha) Draw debug circles for visionRadius and hitRadius.void
drawSkeleton
(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha, com.badlogic.gdx.graphics.Color color) Draw skeleton.com.badlogic.gdx.math.Vector2
float
float
float
getZoom()
void
moveFront
(float distance) Move in the facing direction.boolean
moveIn
(float maxX, float maxY) move Creature location between the rectangle 0,0,maxX,maxY if needed.void
setCenter
(float x, float y) Set center location.void
setCenterX
(float x) void
setCenterY
(float y) void
setRandomLoaction
(float maxX, float maxY) Set center loaction to a random loactionvoid
setZoom
(float zoom) toString()
Standard toString that return important vars as String.void
translate
(float x, float y) Move in x & yMethods inherited from class com.esotericsoftware.spine.utils.SkeletonActor
getAnimationState, getRenderer, getResetBlendFunction, getSkeleton, setAnimationState, setRenderer, setResetBlendFunction, setSkeleton
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor
addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, hit, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, sizeChanged, stageToLocalCoordinates, toBack, toFront
-
Constructor Details
-
MapItemActor
Main constructor.- Parameters:
textureName
- name of the texture to use to represent this ActormapItem
- MapItem represent by this
-
MapItemActor
Secondary constructor with a null texture but a fix size.- Parameters:
mapItem
- MapItem represent by thiswidth
- width of the actorheight
- height of the actor
-
-
Method Details
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha) Draw this actor texture and if showZone draw all debug info. Debug info are represent as circle for visionRadius & hitRadius.- Overrides:
draw
in classcom.esotericsoftware.spine.utils.SkeletonActor
- Parameters:
batch
- batch were to drawparentAlpha
- alpha of the parent to draw at same alpha
-
drawDebugCircles
public void drawDebugCircles(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha) Draw debug circles for visionRadius and hitRadius.- Parameters:
batch
- batch were to drawparentAlpha
- alpha of the parent to draw at same alpha
-
drawSkeleton
public void drawSkeleton(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha, com.badlogic.gdx.graphics.Color color) Draw skeleton.- Parameters:
batch
- batch were to drawparentAlpha
- alpha of the parent to draw at same alphacolor
- color of the parent to draw at same color
-
act
public void act(float delta) Update this actor. It update skeleton to the same rotation and scale than the actor.- Overrides:
act
in classcom.esotericsoftware.spine.utils.SkeletonActor
- Parameters:
delta
- time since last update
-
toString
Standard toString that return important vars as String.- Overrides:
toString
in classcom.badlogic.gdx.scenes.scene2d.Actor
-
setZoom
public void setZoom(float zoom) -
getZoom
public float getZoom() -
setRandomLoaction
public void setRandomLoaction(float maxX, float maxY) Set center loaction to a random loaction- Parameters:
maxX
- max value of xmaxY
- max value of y
-
getCenterX
public float getCenterX() -
getCenterY
public float getCenterY() -
getCenter
public com.badlogic.gdx.math.Vector2 getCenter() -
setCenterX
public void setCenterX(float x) -
setCenterY
public void setCenterY(float y) -
setCenter
public void setCenter(float x, float y) Set center location. -
translate
public void translate(float x, float y) Move in x & y- Parameters:
x
- xy
- y
-
moveFront
public void moveFront(float distance) Move in the facing direction.- Parameters:
distance
- distance to move
-
moveIn
public boolean moveIn(float maxX, float maxY) move Creature location between the rectangle 0,0,maxX,maxY if needed.- Parameters:
maxX
- the max x for the creaturemaxY
- the max y for the creature- Returns:
- true if Creature have been move
-
animate
Animate the creature.- Parameters:
animationName
- Name of the animationanimationId
- Id of the animation. It can be the same as an other animation that need to stop before starting this one.
-