2025-08-26 09:24:09 +08:00
|
|
|
extends EntityBase
|
|
|
|
|
class_name Rooster
|
|
|
|
|
|
2025-08-29 10:50:22 +08:00
|
|
|
func register():
|
|
|
|
|
attackCooldownMap[0] = 200
|
|
|
|
|
attackCooldownMap[1] = 6000
|
2025-11-16 14:32:33 +08:00
|
|
|
hit.connect(
|
2025-11-16 16:10:19 +08:00
|
|
|
func(_damage: float, bullet: BulletBase, _crit: bool):
|
|
|
|
|
if bullet is DogCircle:
|
|
|
|
|
EffectController.create(ComponentManager.getEffect("FeatherFall"), texture.global_position).shot()
|
|
|
|
|
elif bullet is FoxZhua:
|
|
|
|
|
EffectController.create(ComponentManager.getEffect("BloodFall"), texture.global_position).shot()
|
2025-11-16 14:32:33 +08:00
|
|
|
)
|
2025-08-26 09:24:09 +08:00
|
|
|
func ai():
|
2025-08-26 10:55:39 +08:00
|
|
|
texture.play("walk")
|
2025-08-26 10:17:38 +08:00
|
|
|
var direction = Vector2(
|
2025-08-26 09:24:09 +08:00
|
|
|
Input.get_axis("m_left", "m_right"),
|
|
|
|
|
Input.get_axis("m_up", "m_down")
|
|
|
|
|
)
|
2025-08-26 10:17:38 +08:00
|
|
|
move(direction)
|
2025-08-26 10:55:39 +08:00
|
|
|
if direction.length() == 0:
|
|
|
|
|
texture.play("idle")
|
2025-08-26 12:21:09 +08:00
|
|
|
if Input.is_action_pressed("attack"):
|
|
|
|
|
tryAttack(0)
|
2025-09-21 15:24:15 +08:00
|
|
|
if Input.is_action_pressed("attack2"):
|
2025-08-27 19:59:05 +08:00
|
|
|
tryAttack(1)
|
2025-09-21 15:24:15 +08:00
|
|
|
if Input.is_action_pressed("smallSkill"):
|
2025-09-06 17:33:19 +08:00
|
|
|
tryAttack(2)
|
2025-09-21 15:24:15 +08:00
|
|
|
if Input.is_action_pressed("superSkill"):
|
2025-09-06 17:33:19 +08:00
|
|
|
tryAttack(3)
|
2025-09-06 12:02:44 +08:00
|
|
|
for i in range(3):
|
2025-09-06 17:33:19 +08:00
|
|
|
if Input.is_action_pressed("cardSkill" + str(i)):
|
|
|
|
|
tryAttack(4 + i)
|
2025-08-26 14:26:45 +08:00
|
|
|
if Input.is_action_just_pressed("sprint"):
|
|
|
|
|
trySprint()
|
2025-08-27 10:23:57 +08:00
|
|
|
if Input.is_action_just_pressed("heal"):
|
2025-09-26 22:22:49 +08:00
|
|
|
if health < fields.get(FieldStore.Entity.MAX_HEALTH):
|
|
|
|
|
if useItem({
|
|
|
|
|
ItemStore.ItemType.APPLE: 1
|
|
|
|
|
}):
|
|
|
|
|
tryHeal(20)
|
2025-08-26 14:26:45 +08:00
|
|
|
func sprint():
|
|
|
|
|
move(Vector2(
|
|
|
|
|
Input.get_axis("m_left", "m_right"),
|
|
|
|
|
Input.get_axis("m_up", "m_down")
|
2025-08-26 15:52:54 +08:00
|
|
|
) * sprintMultiplier, true)
|