Working on enemy hivemind, it's doing *something* now
This commit is contained in:
@@ -36,11 +36,11 @@ func _on_body_shape_entered(body_rid, body, body_shape_index, local_shape_index)
|
||||
|
||||
func explode():
|
||||
#get all collision objects that can be moved
|
||||
var moveable_rigidbodies = blast_radius_area.get_overlapping_bodies()
|
||||
var bodies_in_blast = blast_radius_area.get_overlapping_bodies()
|
||||
#for each object determine vector from center of blast radius
|
||||
#apply linear velocity power as the inverse % of distance towards the edge (bonus points if using curve texture)
|
||||
#break breakable objects
|
||||
for body in moveable_rigidbodies:
|
||||
for body in bodies_in_blast:
|
||||
|
||||
#calculate blast power and direction
|
||||
var blast_direction = (body.global_position - blast_radius_area.global_position).normalized()
|
||||
@@ -55,6 +55,8 @@ func explode():
|
||||
body.linear_velocity += blast_velocity
|
||||
if body.is_in_group("player"):
|
||||
body.velocity += clamp(blast_velocity,Vector3(-7,-7,-7),Vector3(7,7,7))
|
||||
if body.is_in_group("npc") or body.is_in_group("enemy"):
|
||||
if body.is_in_group("enemy"):
|
||||
body.knocked = true
|
||||
print("knocked")
|
||||
body.knocked_timer.start()
|
||||
body.velocity += blast_velocity
|
||||
body.breaking(blast_velocity)
|
||||
|
||||
Reference in New Issue
Block a user