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 classStores 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 TypeMethodDescriptionvoidact(float delta) Update this actor.voidAnimate the creature.voiddraw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha) Draw this actor texture and if showZone draw all debug info.voiddrawDebugCircles(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha) Draw debug circles for visionRadius and hitRadius.voiddrawSkeleton(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha, com.badlogic.gdx.graphics.Color color) Draw skeleton.com.badlogic.gdx.math.Vector2floatfloatfloatgetZoom()voidmoveFront(float distance) Move in the facing direction.booleanmoveIn(float maxX, float maxY) move Creature location between the rectangle 0,0,maxX,maxY if needed.voidsetCenter(float x, float y) Set center location.voidsetCenterX(float x) voidsetCenterY(float y) voidsetRandomLoaction(float maxX, float maxY) Set center loaction to a random loactionvoidsetZoom(float zoom) toString()Standard toString that return important vars as String.voidtranslate(float x, float y) Move in x & yMethods inherited from class com.esotericsoftware.spine.utils.SkeletonActor
getAnimationState, getRenderer, getResetBlendFunction, getSkeleton, setAnimationState, setRenderer, setResetBlendFunction, setSkeletonMethods 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:
drawin 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:
actin classcom.esotericsoftware.spine.utils.SkeletonActor- Parameters:
delta- time since last update
-
toString
Standard toString that return important vars as String.- Overrides:
toStringin 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.
-