Added weapon interface class
This commit is contained in:
parent
07b57dc1f7
commit
b0573be749
30
game/assets/items/iWeapon.gd
Normal file
30
game/assets/items/iWeapon.gd
Normal file
@ -0,0 +1,30 @@
|
||||
# weapon.gd
|
||||
extends Resource
|
||||
class_name iWeapon
|
||||
# This acts as an interface base class.
|
||||
|
||||
# --- Common Stats ---
|
||||
@export var weapon_name: String = "Unnamed Weapon"
|
||||
@export var damage: float = 10.0
|
||||
@export var attack_speed: float = 1.0 # attacks per second
|
||||
@export var range: float = 1.5 # meters; melee = short, ranged = long
|
||||
@export var knockback: float = 0.0
|
||||
@export var stamina_cost: float = 5.0
|
||||
|
||||
# --- Ranged‑specific Stats ---
|
||||
@export var projectile_scene: PackedScene # null for melee
|
||||
@export var projectile_speed: float = 20.0
|
||||
@export var ammo_type: String = "" # e.g. "arrows", "bullets"
|
||||
@export var ammo_per_shot: int = 1
|
||||
|
||||
# --- Melee‑specific Stats ---
|
||||
@export var swing_arc: float = 90.0 # degrees
|
||||
@export var hitbox_size: float = 1.0
|
||||
|
||||
# --- Interface Methods ---
|
||||
func attack(user):
|
||||
push_error("Weapon.attack() not implemented in subclass")
|
||||
return null
|
||||
|
||||
func can_attack(user) -> bool:
|
||||
return true
|
||||
1
game/assets/items/iWeapon.gd.uid
Normal file
1
game/assets/items/iWeapon.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bttaq8w3plgqh
|
||||
Loading…
x
Reference in New Issue
Block a user