settings, small fixes
This commit is contained in:
parent
b12c193636
commit
e08e3ebb13
174 changed files with 997 additions and 1040 deletions
39
scripts/mask_data.gd
Normal file
39
scripts/mask_data.gd
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
class_name MaskData extends Resource
|
||||
|
||||
enum MaskType { MELEE, RANGED, SPIT }
|
||||
|
||||
@export_group("Assets")
|
||||
@export var mask_name: String
|
||||
@export var texture: Texture2D
|
||||
@export var drop_texture: Texture2D
|
||||
@export var spawn_sfx : String
|
||||
|
||||
@export_group("Combat")
|
||||
@export var attack_scene: PackedScene
|
||||
@export var cooldown: float = 0.5
|
||||
@export var damage: int = 1
|
||||
@export var is_parented_to_attacker: bool = false
|
||||
|
||||
func activate(attacker: Node2D, target_pos: Vector2) -> void:
|
||||
if not attack_scene:
|
||||
return
|
||||
|
||||
var atk = attack_scene.instantiate()
|
||||
|
||||
if is_parented_to_attacker:
|
||||
attacker.add_child(atk)
|
||||
atk.position = Vector2.ZERO
|
||||
else:
|
||||
attacker.get_parent().add_child(atk)
|
||||
atk.global_position = attacker.global_position
|
||||
|
||||
atk.look_at(target_pos)
|
||||
|
||||
if atk.get("start_position"):
|
||||
atk.start_position = attacker.global_position
|
||||
atk.target_position = target_pos
|
||||
|
||||
if atk.has_method("set_from_player"):
|
||||
atk.set_from_player(attacker.is_in_group("player"))
|
||||
|
||||
SoundManager.play_sfx(spawn_sfx)
|
||||
Loading…
Add table
Add a link
Reference in a new issue