Files
Game/src/main/java/uno/mloluyu/desktop/character/Alice.java
2025-09-21 21:48:57 +08:00

57 lines
2.1 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package uno.mloluyu.desktop.character;
import uno.mloluyu.characters.Fighter;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
/**
* 角色类继承自Fighter父类
*/
public class Alice extends Fighter {
public Alice(TextureAtlas atlas) {
super(atlas);
speed = 350f; // 速度更快
maxHealth = 90; // 生命值较低
health = maxHealth;
attackPower = 12; // 攻击力中等
}
@Override
protected void loadAnimations() {
loadAnimationFromAtlas(Action.IDLE, "stand", 15, true);
loadAnimationFromAtlas(Action.WALK, "walkFront", 9, true);
loadAnimationFromAtlas(Action.JUMP, "jump", 8, false);
loadAnimationFromAtlas(Action.FALL, "hitSpin", 5, false);
loadAnimationFromAtlas(Action.ATTACK1, "attackAa", 6, false);
loadAnimationFromAtlas(Action.ATTACK2, "attackAb", 6, false);
loadAnimationFromAtlas(Action.ATTACK3, "attackAc", 6, false);
loadAnimationFromAtlas(Action.ATTACK4, "attackAd", 6, false);
loadAnimationFromAtlas(Action.HIT, "hitSpin", 5, false);
// 为忍者特定动作设置帧间隔
setFrameDuration(Action.WALK, 0.08f); // 行走更快
setFrameDuration(Action.ATTACK1, 0.07f); // 攻击更快
setFrameDuration(Action.SPECIAL2, 0.06f); // 特殊技能2非常快
}
// 忍者特定的移动状态处理
@Override
protected void handleMoveState() {
// 忍者在跳跃时也能移动
if (currentAction != Action.ATTACK1 && currentAction != Action.ATTACK2 &&
currentAction != Action.ATTACK3 && currentAction != Action.SPECIAL1 &&
currentAction != Action.SPECIAL2 && currentAction != Action.DEFEND) {
if (currentAction != Action.JUMP && currentAction != Action.FALL) {
changeAction(Action.WALK);
}
}
}
// 忍者可以在空中攻击
@Override
protected boolean canAttack() {
return super.canAttack() || currentAction == Action.JUMP || currentAction == Action.FALL;
}
}