massive work towards godot 4

This commit is contained in:
2023-02-01 04:43:50 -05:00
parent 42259a89ed
commit 5dac6ced93
484 changed files with 5935 additions and 5084 deletions

View File

@@ -0,0 +1,33 @@
class_name EquipmentSaber
extends Equipment
@export
var animation_player: AnimationPlayer
@export
var area: Area2D
@export
var damage: int = 1
func _ready() -> void:
self.init_equipment()
self.area.body_entered.connect(self._on_body_entered)
self._update_z_index()
func _process(delta: float) -> void:
self.process_equipment(delta)
if self.is_sheathed():
if self.animation_player.current_animation != "sheathed":
self.animation_player.play("sheathed")
else:
if not self.animation_player.current_animation in ["attack", "idle"]:
self.animation_player.play("idle")
if Input.is_action_just_pressed("attack"):
self.animation_player.play("attack")
func _on_body_entered(body: Node2D) -> void:
if body.has_method("take_damage"):
body.take_damage(self.damage)