Adding loads of icons and starting refactor of weapons and mods
This commit is contained in:
parent
1a959fbc0c
commit
f97521decc
4411 changed files with 74792 additions and 42 deletions
|
|
@ -105,7 +105,8 @@ func _on_body_entered(body):
|
|||
return
|
||||
|
||||
# Check if the colliding body is an enemy or object
|
||||
if body.is_in_group("enemies") or body.is_in_group("objects"):
|
||||
if body.is_in_group("enemies"):
|
||||
Log.pr("Hit enemy: ", body.name)
|
||||
if not has_collided: # Only process the first collision
|
||||
# Set collision state and point
|
||||
has_collided = true
|
||||
|
|
@ -114,6 +115,7 @@ func _on_body_entered(body):
|
|||
var direction_to_body = (body.global_position - global_position).normalized()
|
||||
var body_radius = 10.0 # Adjust for your game
|
||||
collision_point = body.global_position - (direction_to_body * body_radius)
|
||||
Log.pr("Collision point updated to: ", collision_point)
|
||||
|
||||
# Debug output
|
||||
Log.pr("Lightning hit: " + body.name + " at point: " + str(collision_point))
|
||||
|
|
@ -121,9 +123,7 @@ func _on_body_entered(body):
|
|||
# IMPORTANT: Immediately update the collision shape to stop at collision point
|
||||
update_collision_shape()
|
||||
|
||||
_trigger_explosion()
|
||||
|
||||
#super._on_body_entered(body)
|
||||
#_trigger_explosion()
|
||||
|
||||
|
||||
if body.is_in_group("enemies") and is_friendly:
|
||||
|
|
@ -131,32 +131,24 @@ func _on_body_entered(body):
|
|||
# Deal damage to enemy
|
||||
if body.has_method("take_damage"):
|
||||
body.take_damage(damage)
|
||||
|
||||
# Emit signal for modifiers to react to
|
||||
emit_signal("on_hit", self, body)
|
||||
|
||||
# Handle piercing
|
||||
if pierce_count > 0:
|
||||
pierce_count -= 1
|
||||
else:
|
||||
# Handle explosive impact
|
||||
if has_explosive_impact:
|
||||
# Store the target that triggered the explosion
|
||||
ignore_target.append(body)
|
||||
_trigger_explosion()
|
||||
|
||||
# Handle piercing
|
||||
if pierce_count > 0:
|
||||
pierce_count -= 1
|
||||
else:
|
||||
# Handle explosive impact
|
||||
if has_explosive_impact:
|
||||
# Store the target that triggered the explosion
|
||||
ignore_target.append(body)
|
||||
#_trigger_explosion()
|
||||
self.call_deferred("_trigger_explosion")
|
||||
|
||||
# Emit signal for modifiers to react to
|
||||
emit_signal("on_hit", self, body)
|
||||
|
||||
|
||||
func _spawn_explosion_projectiles():
|
||||
for i in range(explosion_projectile_count):
|
||||
# Create a new projectile
|
||||
Log.pr("Spawning explosion projectile")
|
||||
var new_proj = (load(scene_file_path) as PackedScene).instantiate()
|
||||
Log.pr("New projectile: ", new_proj)
|
||||
new_proj.global_position = collision_point
|
||||
|
||||
var min_distance = 50
|
||||
var max_distance = 125
|
||||
|
||||
# Generate a random angle
|
||||
var max_target_distance = 200 # Maximum distance to look for enemies
|
||||
|
||||
# Get all enemies in the scene
|
||||
|
|
@ -177,14 +169,16 @@ func _spawn_explosion_projectiles():
|
|||
var random_enemy = valid_targets[randi() % valid_targets.size()]
|
||||
random_point = random_enemy.global_position
|
||||
else:
|
||||
# Fallback if no enemies in range - use the original random point logic
|
||||
var random_angle = randf_range(0, TAU)
|
||||
var random_distance = randf_range(50, max_target_distance)
|
||||
random_point = collision_point + Vector2(
|
||||
cos(random_angle) * random_distance,
|
||||
sin(random_angle) * random_distance
|
||||
)
|
||||
return
|
||||
|
||||
Log.pr("Spawning explosion projectile")
|
||||
var new_proj = (load(scene_file_path) as PackedScene).instantiate()
|
||||
Log.pr("New projectile: ", new_proj)
|
||||
|
||||
new_proj.global_position = collision_point
|
||||
Log.pr("New projectile spawn: ", new_proj.global_position)
|
||||
|
||||
|
||||
new_proj.target_position = random_point
|
||||
|
||||
new_proj.damage = damage * explosion_projectile_damage_mult
|
||||
|
|
@ -203,5 +197,4 @@ func _spawn_explosion_projectiles():
|
|||
get_tree().root.call_deferred("add_child", new_proj)
|
||||
|
||||
func _on_lifetime_timeout():
|
||||
Log.pr("ProjectileLightning _on_lifetime_timeout")
|
||||
super._on_lifetime_timeout()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue