From c232b92e2dde1277324d1f89d0e75ae641e4ac3b Mon Sep 17 00:00:00 2001 From: Anson Bridges Date: Wed, 7 Sep 2022 14:07:30 -0400 Subject: reorganized, ladders, vehicle control --- godot/scripts/ballistics/Cannonball.gd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 godot/scripts/ballistics/Cannonball.gd (limited to 'godot/scripts/ballistics/Cannonball.gd') diff --git a/godot/scripts/ballistics/Cannonball.gd b/godot/scripts/ballistics/Cannonball.gd new file mode 100644 index 0000000..14de00c --- /dev/null +++ b/godot/scripts/ballistics/Cannonball.gd @@ -0,0 +1,17 @@ +extends "res://scripts/ballistics/NetworkedProjectile.gd" + +export var drag_constant = 0.3 +var damage_exceptions = [] +var oldvel + +func _physics_process(_delta): + oldvel = linear_velocity + add_force(-1*linear_velocity*drag_constant, Vector3.ZERO) + +func get_init_info(): + return {"linear_velocity" : linear_velocity, "angular_velocity" : angular_velocity, "oldvel" : oldvel, "shooter" : shooter, "shooter_id" : shooter_id} + +func _on_collision(body): + if oldvel.length() > 20 and !damage_exceptions.has(body) and body.has_method("damage"): + body.rpc("damage", oldvel.length(), "blunt", shooter, "using 'cannon'") + damage_exceptions.append(body) -- cgit v1.2.3