/** * @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; } } }
/** @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()); } } }
/** * 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); } } }