Compare commits

..

No commits in common. "a27e6517ccdf31ffaff46eec31aa395c061cfdd8" and "9c3f4a8a269a299ec5e547c4cc46e0381c1c302e" have entirely different histories.

6 changed files with 15 additions and 63 deletions

View File

@ -1,4 +0,0 @@
[gd_resource type="ConcavePolygonShape" format=2]
[resource]
data = PoolVector3Array( 0, 0, 10, 0.9511, 0.309, 0, 1, 0, 0, 0, 0, 10, 0.809, 0.5878, 0, 0.9511, 0.309, 0, 0, 0, 10, 0.5878, 0.809, 0, 0.809, 0.5878, 0, 0, 0, 10, 0.309, 0.9511, 0, 0.5878, 0.809, 0, 0, 0, 10, 0, 1, 0, 0.309, 0.9511, 0, 0, 0, 10, -0.309, 0.9511, 0, 0, 1, 0, 0, 0, 10, -0.5878, 0.809, 0, -0.309, 0.9511, 0, 0, 0, 10, -0.809, 0.5878, 0, -0.5878, 0.809, 0, 0, 0, 10, -0.9511, 0.309, 0, -0.809, 0.5878, 0, 0, 0, 10, -1, 0, 0, -0.9511, 0.309, 0, 0, 0, 10, -0.9511, -0.309, 0, -1, 0, 0, 0, 0, 10, -0.809, -0.5878, 0, -0.9511, -0.309, 0, 0, 0, 10, -0.5878, -0.809, 0, -0.809, -0.5878, 0, 0, 0, 10, -0.309, -0.9511, 0, -0.5878, -0.809, 0, 0, 0, 10, 0, -1, 0, -0.309, -0.9511, 0, 0, 0, 10, 0.309, -0.9511, 0, 0, -1, 0, 0, 0, 10, 0.5878, -0.809, 0, 0.309, -0.9511, 0, 0, 0, 10, 0.809, -0.5878, 0, 0.5878, -0.809, 0, 0, 0, 10, 0.9511, -0.309, 0, 0.809, -0.5878, 0, 0, 0, 10, 1, 0, 0, 0.9511, -0.309, 0, 0.9511, 0.309, 0, 0.9511, -0.309, 0, 1, 0, 0, 0.9511, 0.309, 0, 0.809, -0.5878, 0, 0.9511, -0.309, 0, 0.809, 0.5878, 0, 0.809, -0.5878, 0, 0.9511, 0.309, 0, 0.809, 0.5878, 0, 0.5878, -0.809, 0, 0.809, -0.5878, 0, 0.5878, 0.809, 0, 0.5878, -0.809, 0, 0.809, 0.5878, 0, 0.5878, 0.809, 0, 0.309, -0.9511, 0, 0.5878, -0.809, 0, 0.309, 0.9511, 0, 0.309, -0.9511, 0, 0.5878, 0.809, 0, 0.309, 0.9511, 0, 0, -1, 0, 0.309, -0.9511, 0, 0, 1, 0, 0, -1, 0, 0.309, 0.9511, 0, 0, 1, 0, -0.309, -0.9511, 0, 0, -1, 0, -0.309, 0.9511, 0, -0.309, -0.9511, 0, 0, 1, 0, -0.309, 0.9511, 0, -0.5878, -0.809, 0, -0.309, -0.9511, 0, -0.5878, 0.809, 0, -0.5878, -0.809, 0, -0.309, 0.9511, 0, -0.5878, 0.809, 0, -0.809, -0.5878, 0, -0.5878, -0.809, 0, -0.809, 0.5878, 0, -0.809, -0.5878, 0, -0.5878, 0.809, 0, -0.809, 0.5878, 0, -0.9511, -0.309, 0, -0.809, -0.5878, 0, -0.9511, 0.309, 0, -0.9511, -0.309, 0, -0.809, 0.5878, 0, -0.9511, -0.309, 0, -0.9511, 0.309, 0, -1, 0, 0 )

View File

@ -1,7 +1,6 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Scripts/Player.gd" type="Script" id=1]
[ext_resource path="res://Models/cone-collision.tres" type="Shape" id=2]
[sub_resource type="CapsuleShape" id=1]
radius = 0.15
@ -21,11 +20,3 @@ transform = Transform( 2.65431e-15, 1.62921e-08, 0.1, 0.1, -1.62921e-08, 0, 1.62
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.769, 0 )
enabled = true
cast_to = Vector3( 0, 500, 0 )
[node name="Cone" type="Area" parent="GunContainer"]
[node name="CollisionShape" type="CollisionShape" parent="GunContainer/Cone"]
transform = Transform( 25, 0, 1.81899e-12, 4.54747e-13, -4.07302e-06, -100, 5.42101e-20, 25, -1.62921e-05, -1.49012e-08, 1000, -1.33014e-11 )
shape = ExtResource( 2 )
[connection signal="body_entered" from="GunContainer/Cone" to="." method="_on_player_enter_firing_arc"]
[connection signal="body_exited" from="GunContainer/Cone" to="." method="_on_player_exit_firing_arc"]

View File

@ -15,5 +15,4 @@ __meta__ = {
[node name="ExitTimer" type="Timer" parent="."]
one_shot = true
[connection signal="timeout" from="ExitTimer" to="." method="end_game"]

View File

@ -36,12 +36,10 @@ func _process(delta : float) -> void:
player.calculate_plans()
func generate_translation() -> Vector3:
#return Vector3(rand_range(-5,5),rand_range(-5,5),rand_range(-5,5))
return Vector3(0,0,rand_range(-5,5))
return Vector3(rand_range(-5,5),rand_range(-5,5),rand_range(-5,5))
func generate_rotation() -> Vector3:
#return Vector3(rand_range(-1,1),rand_range(-1,1),rand_range(-1,1)).normalized()
return Vector3(0,0,1)
return Vector3(rand_range(-1,1),rand_range(-1,1),rand_range(-1,1)).normalized()
func play_full_plans():
for player in players.values():

View File

@ -14,8 +14,6 @@ var weapons_plan : Plan = Plan.new()
var is_ready : bool = false
var running_plan : bool = false
var was_running_plan : bool = false
var using_full_plan : bool = false
var plan_time : float = 0.0
var health : float = 100.0
@ -40,9 +38,8 @@ var end_linear_velocity : Vector3 = Vector3.ZERO
var end_rotational_velocity : Vector3 = Vector3.ZERO
var end_health : float = 100.0
var end_energy : float = 100.0
var energy : float = 100.0
var players_in_firing_arc = []
var energy : float = 100.0
func init():
last_rotation = get_rotation()
@ -117,29 +114,13 @@ func _get_all_weapons_elements():
func _physics_process(delta : float) -> void:
if !enable_physics:
return
if !running_plan:
if waiting_for_completion:
send_all_plans()
waiting_for_completion = false
translation = last_translation
rotation = last_rotation
was_running_plan = false
return
if !was_running_plan:
players_in_firing_arc = $GunContainer/Cone.get_overlapping_bodies()
if using_full_plan:
set_linear_velocity(initial_velocity)
set_angular_velocity(initial_rotational_velocity)
set_translation(initial_translation)
set_rotation(initial_rotation)
else:
set_linear_velocity(end_linear_velocity)
set_angular_velocity(end_rotational_velocity)
set_translation(end_translation)
set_rotation(end_rotation)
was_running_plan = true
var all_thrust_elements = _get_all_thrust_elements()
var current_thrust_element : ThrustElement = _get_current_plan_element(all_thrust_elements)
if current_thrust_element == null:
@ -166,19 +147,10 @@ func _physics_process(delta : float) -> void:
plan_time += delta
func fire(delta : float, time : float) -> void:
var closest_enemy = null
var distance_of_closest = -1
for player in players_in_firing_arc:
if player.id == id or !player.is_alive:
continue
var player_distance : float = (player.translation - translation).length()
if distance_of_closest == -1 or player_distance < distance_of_closest:
closest_enemy = player
distance_of_closest = player_distance
energy -= delta * BASE_ENERGY_USAGE
if closest_enemy != null:
closest_enemy.take_damage(BASE_DPS * delta, time)
if $GunContainer/RayCast.is_colliding():
var target : RigidBody = $GunContainer/RayCast.get_collider()
target.take_damage(BASE_DPS * delta, time)
func take_damage(damage : float, time : float) -> void:
health -= damage
@ -187,7 +159,6 @@ func take_damage(damage : float, time : float) -> void:
func die(time : float) -> void:
is_alive = false
$GunContainer/Cone.monitoring = false
if !has_died:
if report_death_to_arena():
finish_game()
@ -200,20 +171,24 @@ func play_all_plans():
get_parent().play_full_plans()
func play_full_plan():
using_full_plan = true
set_linear_velocity(initial_velocity)
set_angular_velocity(initial_rotational_velocity)
set_translation(initial_translation)
set_rotation(initial_rotation)
running_plan = true
plan_time = 0.0
is_alive = true
$GunContainer/Cone.monitoring = true
$CollisionShape.disabled = false
func play_last_plan():
using_full_plan = false
set_linear_velocity(end_linear_velocity)
set_angular_velocity(end_rotational_velocity)
set_translation(end_translation)
set_rotation(end_rotation)
running_plan = true
plan_time = 5 * turn_number
if !has_died:
is_alive = true
$GunContainer/Cone.monitoring = true
$CollisionShape.disabled = false
func calculate_plans():
@ -234,9 +209,3 @@ func report_death_to_arena() -> bool:
func finish_game() -> void:
get_parent().finish_game()
func _on_player_enter_firing_arc(body):
players_in_firing_arc.append(body)
func _on_player_exit_firing_arc(body):
players_in_firing_arc.erase(body)

View File

@ -44,7 +44,6 @@ config/icon="res://icon.png"
[physics]
3d/physics_engine="GodotPhysics"
3d/default_gravity=0.0
[rendering]