Implements a lightning projectile with visual effects. The lightning is created using a series of bolt components that dynamically adjust their shape. Also refactors the projectile system to use a base class. Removes unused modifiers from player script.
51 lines
1.4 KiB
GDScript
51 lines
1.4 KiB
GDScript
extends CharacterBody2D
|
|
|
|
@export var speed = 200
|
|
@export var special_ability: Ability
|
|
|
|
var weapon: RangedWeapon
|
|
|
|
var movement: PlayerMovement
|
|
var combat: PlayerCombat
|
|
|
|
# Last direction for idle state
|
|
var last_direction = Vector2.DOWN
|
|
|
|
@onready var animated_sprite = $PlayerSprite
|
|
|
|
func _ready():
|
|
weapon = $RangedWeapon
|
|
combat = PlayerCombat.new()
|
|
|
|
movement = PlayerMovement.new()
|
|
movement.player = self
|
|
movement.animated_sprite = animated_sprite
|
|
movement.speed = speed
|
|
|
|
combat.player = self
|
|
combat.animated_sprite = animated_sprite
|
|
|
|
Log.pr("Adding projectile size additive modifier")
|
|
#weapon.add_modifier(ProjectileSizeAdditive.new())
|
|
Log.pr(weapon.stats.get_stat("projectile_size")) # Size is now 1.0 + 0.5 = 1.5
|
|
# Size is now 1.0 + 0.5 = 1.5
|
|
|
|
# Add the multiplicative size modifier (1.5x multiplier)
|
|
Log.pr("Adding projectile size multiplicative modifier")
|
|
#weapon.add_modifier(ProjectileSizeMultiplicative.new())
|
|
Log.pr(weapon.stats.get_stat("projectile_size"))
|
|
# Size is now 1.5 * 1.5 = 2.25
|
|
|
|
# Add another additive size modifier (+0.7 or 70% increase)
|
|
Log.pr("Adding another projectile size additive modifier", 2)
|
|
var another_size_mod = ProjectileSizeAdditive.new()
|
|
another_size_mod.size_increase = 0.7
|
|
#weapon.add_modifier(another_size_mod)
|
|
Log.pr(weapon.stats.get_stat("projectile_size"))
|
|
|
|
#weapon.add_modifier(FireRateAdditive.new())
|
|
|
|
|
|
func _physics_process(delta):
|
|
movement.process(delta)
|
|
combat.process(delta)
|