/** @see net.wombatrpgs.rainfall.maps.events.MapEvent#halt() */ @Override public void halt() { super.halt(); if (!pacing) { appearance.stopMoving(); appearance.update(0); } targetVX = 0; targetVY = 0; for (Direction dir : directionStatus.keySet()) { directionStatus.put(dir, false); } }
/** * @see net.wombatrpgs.rainfall.maps.MapObject#queueRequiredAssets * (com.badlogic.gdx.assets.AssetManager) */ @Override public void queueRequiredAssets(AssetManager manager) { if (appearance != null) { appearance.queueRequiredAssets(manager); } if (convo != null) { convo.queueRequiredAssets(manager); } if (soundHurt != null) { soundHurt.queueRequiredAssets(manager); } if (idleAnim != null) { idleAnim.queueRequiredAssets(manager); } }
/** @see net.wombatrpgs.rainfall.maps.MapObject#internalTargetVelocity(float, float) */ @Override protected void internalTargetVelocity(float targetVX, float targetVY) { if (appearance != null && (targetVX != this.targetVX || targetVY != this.targetVY) && (Math.abs(targetVX) > .1 || Math.abs(targetVY) > .1)) { Direction newDir; if (Math.abs(targetVX) >= Math.abs(targetVY)) { if (targetVX * Direction.RIGHT.getVector().x > 0) { newDir = Direction.RIGHT; } else { newDir = Direction.LEFT; } } else { if (targetVY * Direction.DOWN.getVector().y > 0) { newDir = Direction.DOWN; } else { newDir = Direction.UP; } } setFacing(newDir); if (appearance == idleAnim) { appearance = walkAnim; } walkAnim.startMoving(); } super.internalTargetVelocity(targetVX, targetVY); }
/** * @see net.wombatrpgs.rainfall.graphics.Renderable#render * (com.badlogic.gdx.graphics.OrthographicCamera) */ @Override public void render(OrthographicCamera camera) { if (hidden()) return; super.render(camera); if (appearance != null) { appearance.render(camera); } }
/** @see net.wombatrpgs.rainfall.maps.MapObject#update(float) */ @Override public void update(float elapsed) { if (hidden()) return; super.update(elapsed); if (!pacing && appearance != null) { appearance.update(elapsed); } }
/** * Does not actually do anything but registers this move as having started. * * @param act The act that's being started */ public void startAction(MovesetAct act) { if (!canAct()) return; activeMoves.add(act); if (act.getAppearance() != null) { setAppearance(act.getAppearance()); act.getAppearance().reset(); setFacing(walkAnim.getFacing()); } }
/** @see net.wombatrpgs.rainfall.maps.MapObject#vitalUpdate(float) */ @Override public void vitalUpdate(float elapsed) { super.vitalUpdate(elapsed); if (pacing && appearance != null) { appearance.update(elapsed); } if (!pacing && walkAnim != null) if (Math.abs(vx) < .1 && Math.abs(vy) < .1 && Math.abs(targetVX) < .1 && Math.abs(targetVY) < .1) { walkAnim.stopMoving(); if (appearance == walkAnim) { appearance = idleAnim; idleAnim.setFacing(walkAnim.getFacing()); } } }
/** @see net.wombatrpgs.rainfall.maps.MapObject#getHitbox() */ @Override public Hitbox getHitbox() { if (appearance == null || hidden()) return NoHitbox.getInstance(); switch (mdo.collision) { case ANIMATION_SPECIFIC_RECTANGLE: return appearance.getHitbox(); case SOMETHING_ELSE_TELL_PSY_RIGHT_AWAY: RGlobal.reporter.warn("Got a hitbox for something totally weird"); return NoHitbox.getInstance(); case NONE: return NoHitbox.getInstance(); default: RGlobal.reporter.warn("No hitbox setting found on " + this); return NoHitbox.getInstance(); } }
/** * Registers a move as having stopped. Adjusts appearance back to normal. * * @param act The act that's being stopped */ public void stopAction(MovesetAct act) { if (activeMoves.contains(act)) { activeMoves.remove(act); } else { RGlobal.reporter.warn("Removed an unperformed action: " + act); } if (activeMoves.size() == 0 && appearance != walkAnim) { appearance = walkAnim; if (targetVX != 0 && targetVY != 0) { Direction newFace; if (Math.abs(targetVX) > Math.abs(targetVY)) { newFace = (targetVX > 0) ? Direction.RIGHT : Direction.LEFT; } else { newFace = (targetVY > 0) ? Direction.UP : Direction.DOWN; } walkAnim.setFacing(newFace); } } }
/** * @see net.wombatrpgs.rainfall.graphics.Renderable#postProcessing * (com.badlogic.gdx.assets.AssetManager, int) */ @Override public void postProcessing(AssetManager manager, int pass) { super.postProcessing(manager, pass); if (appearance != null) { appearance.postProcessing(manager, pass); } if (convo != null) { convo.postProcessing(manager, pass); } if (soundHurt != null) { soundHurt.postProcessing(manager, pass); } if (idleAnim != null) { idleAnim.postProcessing(manager, pass); } else { idleAnim = walkAnim; } if (object != null) { String dir = object.properties.get(PROPERTY_FACING); if (dir != null) { if (dir.equals(DIR_DOWN)) { appearance.setFacing(Direction.DOWN); } else if (dir.equals(DIR_UP)) { appearance.setFacing(Direction.UP); } else if (dir.equals(DIR_RIGHT)) { appearance.setFacing(Direction.RIGHT); } else if (dir.equals(DIR_LEFT)) { appearance.setFacing(Direction.LEFT); } else { RGlobal.reporter.warn("Not a valid direction on char " + this + " : " + dir); } } if (object.properties.get(PROPERTY_WALK_IN_PLACE) != null) { appearance.startMoving(); pacing = true; } } }
/** * Overrides the pacing action of this character. * * @param pacing True if character should pace, false otherwise */ public void setPacing(boolean pacing) { this.pacing = pacing; if (pacing) { appearance.startMoving(); } }
/** @see net.wombatrpgs.rainfall.graphics.PreRenderable#getRegion() */ @Override public TextureRegion getRegion() { if (hidden() || appearance == null) return null; return appearance.getRegion(); }
/** * Gets the direction this character is currently facing from its animation * * @return The direction currently facing */ public Direction getFacing() { return appearance.getFacing(); }