1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 23:11:54 +08:00
Files
Dog-Lynx-And-HCN/scripts/Contents/Characters/Rooster.gd
T

29 lines
746 B
GDScript
Raw Normal View History

2025-08-26 09:24:09 +08:00
extends EntityBase
class_name Rooster
func _ready():
super._ready()
2025-08-26 09:24:09 +08:00
func ai():
texture.play("walk")
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")
)
move(direction)
if direction.length() == 0:
texture.play("idle")
if Input.is_action_pressed("attack"):
tryAttack(0)
if Input.is_action_just_pressed("sprint"):
trySprint()
func attack(type):
if type == 0:
var weaponPos = findWeaponAnchor("normal")
BulletBase.generate(preload("res://components/Bullets/PurpleCrystal.tscn"), self, weaponPos, (get_global_mouse_position() - weaponPos).angle())
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)