Compare commits

..

No commits in common. "8c8a5e00d729a6dd1815f9afa4c4dfecd834e0a9" and "88c7a0c504f81598c693dfa6dade6bb4856ba938" have entirely different histories.

10 changed files with 38 additions and 94 deletions

BIN
Models/Cone.obj (Stored with Git LFS)

Binary file not shown.

BIN
Models/Cone.obj.import (Stored with Git LFS)

Binary file not shown.

BIN
Models/Material_001.material (Stored with Git LFS)

Binary file not shown.

BIN
Models/Material_002.material (Stored with Git LFS)

Binary file not shown.

BIN
Models/cone-collision.tres (Stored with Git LFS)

Binary file not shown.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=2] [gd_scene load_steps=17 format=2]
[ext_resource path="res://Scripts/Player.gd" type="Script" id=1] [ext_resource path="res://Scripts/Player.gd" type="Script" id=1]
[ext_resource path="res://Models/Arrow.obj" type="ArrayMesh" id=2] [ext_resource path="res://Models/Arrow.obj" type="ArrayMesh" id=2]
@ -13,7 +13,6 @@
[ext_resource path="res://Images/BatteryBolt.png" type="Texture" id=11] [ext_resource path="res://Images/BatteryBolt.png" type="Texture" id=11]
[ext_resource path="res://Images/BatteryFilling.png" type="Texture" id=12] [ext_resource path="res://Images/BatteryFilling.png" type="Texture" id=12]
[ext_resource path="res://Images/BatteryBackground.png" type="Texture" id=13] [ext_resource path="res://Images/BatteryBackground.png" type="Texture" id=13]
[ext_resource path="res://Models/cone-collision.tres" type="Shape" id=14]
[sub_resource type="CapsuleShape" id=1] [sub_resource type="CapsuleShape" id=1]
radius = 0.15 radius = 0.15
@ -466,29 +465,18 @@ anims/ShowEndTurnBanner = ExtResource( 9 )
[node name="GunContainer" type="Spatial" parent="."] [node name="GunContainer" type="Spatial" parent="."]
transform = Transform( -4.37114e-09, 4.37114e-09, 0.1, 0.1, -4.37114e-09, 4.37114e-09, 4.37114e-09, 0.1, -4.37114e-09, 0, -0.0222926, 0.382747 ) transform = Transform( -4.37114e-09, 4.37114e-09, 0.1, 0.1, -4.37114e-09, 4.37114e-09, 4.37114e-09, 0.1, -4.37114e-09, 0, -0.0222926, 0.382747 )
visible = false
[node name="Cone" type="Area" parent="GunContainer"]
transform = Transform( 1, -1.77636e-14, 1.91069e-15, 1.77636e-14, 1, -1.77636e-14, -1.91069e-15, 1.77636e-14, 1, 1.19209e-07, 2.66684, -1.16571e-07 )
input_ray_pickable = false
gravity = 0.0
linear_damp = 0.0
angular_damp = 0.0
[node name="CollisionShape" type="CollisionShape" parent="GunContainer/Cone"]
transform = Transform( 25, 0, 0, 0, -4.07302e-06, -100, 0, 25, -1.62921e-05, 0, 1000, 0 )
shape = ExtResource( 14 )
[node name="spaceship-gun" parent="GunContainer" instance=ExtResource( 10 )] [node name="spaceship-gun" parent="GunContainer" instance=ExtResource( 10 )]
transform = Transform( 1, 0, 1.64203e-15, 0, 1, 0, 1.64203e-15, 0, 1, 4.47035e-08, 0.811224, -3.54597e-08 ) transform = Transform( 1, 0, 1.64203e-15, 0, 1, 0, 1.64203e-15, 0, 1, 4.47035e-08, 0.811224, -3.54597e-08 )
[node name="RayCast" type="RayCast" parent="GunContainer"] [node name="RayCast" type="RayCast" parent="GunContainer"]
transform = Transform( 1, 0, 1.64203e-15, 0, 1, 0, 1.64203e-15, 0, 1, 7.45058e-08, 1.76881, -7.73171e-08 ) transform = Transform( 1, 0, 1.64203e-15, 0, 1, 0, 1.64203e-15, 0, 1, 7.45058e-08, 1.76881, -7.73171e-08 )
visible = false
enabled = true enabled = true
cast_to = Vector3( 0, 0, -500 ) cast_to = Vector3( 0, 500, 0 )
[node name="CSGCylinder" type="CSGCylinder" parent="GunContainer/RayCast"] [node name="CSGCylinder" type="CSGCylinder" parent="GunContainer/RayCast"]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 30, 0 ) transform = Transform( 1, 0, 1.64203e-15, 0, 1, 0, 1.64203e-15, 0, 1, 0, 30, 0 )
material_override = SubResource( 3 ) material_override = SubResource( 3 )
radius = 0.09 radius = 0.09
height = 60.0 height = 60.0
@ -626,7 +614,6 @@ margin_left = 10.0
margin_top = 10.0 margin_top = 10.0
margin_right = -10.0 margin_right = -10.0
margin_bottom = -10.0 margin_bottom = -10.0
[connection signal="mouse_entered" from="." to="." method="_on_Player_mouse_entered"] [connection signal="mouse_entered" from="." to="." method="_on_Player_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_Player_mouse_exited"] [connection signal="mouse_exited" from="." to="." method="_on_Player_mouse_exited"]
[connection signal="value_changed" from="MainPanel/TimeBar" to="." method="_on_TimeBar_value_changed"] [connection signal="value_changed" from="MainPanel/TimeBar" to="." method="_on_TimeBar_value_changed"]
@ -643,5 +630,3 @@ margin_bottom = -10.0
[connection signal="value_changed" from="ThrustPanel/ZLin" to="." method="_on_ZLin_value_changed"] [connection signal="value_changed" from="ThrustPanel/ZLin" to="." method="_on_ZLin_value_changed"]
[connection signal="value_changed" from="ThrustPanel/ZRot" to="." method="_on_ZRot_value_changed"] [connection signal="value_changed" from="ThrustPanel/ZRot" to="." method="_on_ZRot_value_changed"]
[connection signal="pressed" from="ThrustPanel/ResetButton" to="." method="_on_ResetButton_pressed"] [connection signal="pressed" from="ThrustPanel/ResetButton" to="." method="_on_ResetButton_pressed"]
[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

@ -8,7 +8,6 @@ var thrust_plan : Plan = Plan.new()
var weapons_plan : Plan = Plan.new() var weapons_plan : Plan = Plan.new()
var is_local : bool = false var is_local : bool = false
var running_plan : bool = false var running_plan : bool = false
var using_full_plan : bool = false
var was_running_plan : bool = false var was_running_plan : bool = false
var plan_time : float = 0.0 var plan_time : float = 0.0
var last_translation : Vector3 = get_translation() var last_translation : Vector3 = get_translation()
@ -36,8 +35,6 @@ var end_health : float = 100.0
var energy : float = 100.0 var energy : float = 100.0
var end_energy : float = 100.0 var end_energy : float = 100.0
var players_in_firing_arc = []
onready var arrow_obj : Spatial = $ArrowContainer onready var arrow_obj : Spatial = $ArrowContainer
onready var arrow_scale_obj : Spatial = $ArrowContainer/ArrowScaleContainer onready var arrow_scale_obj : Spatial = $ArrowContainer/ArrowScaleContainer
onready var rotate_arrow_obj : Spatial = $RotateArrowContainer onready var rotate_arrow_obj : Spatial = $RotateArrowContainer
@ -291,7 +288,7 @@ func _physics_process(delta : float) -> void:
if !running_plan: if !running_plan:
if is_local and was_running_plan: if is_local and was_running_plan:
get_parent().show_winner() get_parent().show_winner()
$GunContainer/RayCast.visible = false $GunContainer.visible = false
arrow_obj.visible = true arrow_obj.visible = true
rotate_arrow_obj.visible = true rotate_arrow_obj.visible = true
disable_all_engine_particles() disable_all_engine_particles()
@ -299,19 +296,6 @@ func _physics_process(delta : float) -> void:
set_rotation(last_rotation) set_rotation(last_rotation)
was_running_plan = false was_running_plan = false
return 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 was_running_plan = true
if time_of_death > 0 and plan_time > time_of_death: if time_of_death > 0 and plan_time > time_of_death:
@ -328,7 +312,6 @@ func _physics_process(delta : float) -> void:
last_translation = get_translation() last_translation = get_translation()
last_rotation = get_rotation() last_rotation = get_rotation()
running_plan = false running_plan = false
print("thrust plan set running plan to false")
return return
arrow_obj.visible = false arrow_obj.visible = false
rotate_arrow_obj.visible = false rotate_arrow_obj.visible = false
@ -339,16 +322,16 @@ func _physics_process(delta : float) -> void:
var all_weapons_elements = _get_all_weapons_elements() var all_weapons_elements = _get_all_weapons_elements()
var current_weapons_element : WeaponsElement = _get_current_plan_element(all_weapons_elements) var current_weapons_element : WeaponsElement = _get_current_plan_element(all_weapons_elements)
if current_weapons_element == null: if current_weapons_element == null:
$GunContainer/RayCast.visible = false $GunContainer.visible = false
running_plan = false running_plan = false
return return
if current_weapons_element.firing and is_alive: if current_weapons_element.firing and is_alive:
_fire_gun(delta) _fire_gun(delta)
elif energy < 100: elif energy < 100:
$GunContainer/RayCast.visible = false $GunContainer.visible = false
energy += BASE_ENERGY_REGEN * delta energy += BASE_ENERGY_REGEN * delta
else: else:
$GunContainer/RayCast.visible = false $GunContainer.visible = false
calculate_other_damage(delta) calculate_other_damage(delta)
plan_time += delta plan_time += delta
@ -479,10 +462,13 @@ func update_engine_particles(linear_thrust : Vector3, rotational_thrust : Vector
engine_particles2.emitting = false engine_particles2.emitting = false
func play_current_plan() -> void: func play_current_plan() -> void:
set_linear_velocity(end_linear_velocity)
set_angular_velocity(end_rotational_velocity)
set_translation(end_translation)
set_rotation(end_rotation)
health = end_health health = end_health
energy = end_energy energy = end_energy
using_full_plan = false
running_plan = true running_plan = true
plan_time = 5 * turn_counter plan_time = 5 * turn_counter
@ -490,8 +476,11 @@ func play_all_plans() -> void:
get_parent().play_full_plans() get_parent().play_full_plans()
func play_full_plan() -> void: func play_full_plan() -> void:
set_linear_velocity(initial_velocity)
set_angular_velocity(initial_rotational_velocity)
set_translation(initial_translation)
set_rotation(initial_rotation)
running_plan = true running_plan = true
using_full_plan = true
plan_time = 0.0 plan_time = 0.0
health = 100.0 health = 100.0
energy = 100.0 energy = 100.0
@ -504,34 +493,20 @@ func _update_battery_visuals(value : float) -> void:
func _update_laser(length : float) -> void: func _update_laser(length : float) -> void:
$GunContainer/RayCast/CSGCylinder.height = length*10 $GunContainer/RayCast/CSGCylinder.height = length*10
$GunContainer/RayCast/CSGCylinder.translation = Vector3(0, 0, -length*5) $GunContainer/RayCast/CSGCylinder.translation = Vector3(0, length*5, 0)
func _fire_gun(delta : float) -> void: func _fire_gun(delta : float) -> void:
$GunContainer/RayCast.visible = true $GunContainer.visible = true
if $GunContainer/RayCast.is_colliding():
var closest_enemy = null
var distance_of_closest = -1
for player in players_in_firing_arc:
if player.player_id == player_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
if closest_enemy != null:
$GunContainer/RayCast.look_at($GunContainer/RayCast.global_transform.origin - translation, Vector3(0,1,0))
#$GunContainer/RayCast.rotate_object_local(Vector3(-1,-1,-1).normalized(), 90.0)
var raycast_pos : Vector3 = $GunContainer/RayCast.global_transform.origin var raycast_pos : Vector3 = $GunContainer/RayCast.global_transform.origin
var target_pos : Vector3 = $GunContainer/RayCast.get_collision_point() var target_pos : Vector3 = $GunContainer/RayCast.get_collision_point()
_update_laser(raycast_pos.distance_to(target_pos)) _update_laser(raycast_pos.distance_to(target_pos))
else: else:
$GunContainer/RayCast.rotation = Vector3.ZERO _update_laser($GunContainer/RayCast.cast_to.y)
_update_laser(-$GunContainer/RayCast.cast_to.z)
energy -= delta * BASE_ENERGY_USAGE energy -= delta * BASE_ENERGY_USAGE
if closest_enemy != null: if $GunContainer/RayCast.is_colliding():
closest_enemy.take_damage(BASE_DPS * delta) var target : RigidBody = $GunContainer/RayCast.get_collider()
target.take_damage(BASE_DPS * delta)
func get_display_name() -> String: func get_display_name() -> String:
return get_parent().get_parent().name_dict[player_id] return get_parent().get_parent().name_dict[player_id]
@ -608,11 +583,3 @@ func fix_plans() -> void:
var new_weapons_element : WeaponsElement = WeaponsElement.new() var new_weapons_element : WeaponsElement = WeaponsElement.new()
new_weapons_element.firing = false new_weapons_element.firing = false
new_weapons_element.time = 5.0 - weapons_plan.current_time() new_weapons_element.time = 5.0 - weapons_plan.current_time()
func _on_player_enter_firing_arc(body):
players_in_firing_arc.append(body)
print(body.name)
func _on_player_exit_firing_arc(body):
players_in_firing_arc.erase(body)
print(body.name)

Binary file not shown.

View File

@ -8,20 +8,21 @@ export_filter="all_resources"
include_filter="" include_filter=""
exclude_filter="" exclude_filter=""
export_path="../Builds/Client.x86_64" export_path="../Builds/Client.x86_64"
patch_list=PoolStringArray( )
script_export_mode=1 script_export_mode=1
script_encryption_key="" script_encryption_key=""
[preset.0.options] [preset.0.options]
custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=false
texture_format/bptc=false texture_format/bptc=false
texture_format/s3tc=true texture_format/s3tc=true
texture_format/etc=false texture_format/etc=false
texture_format/etc2=false texture_format/etc2=false
texture_format/no_bptc_fallbacks=true texture_format/no_bptc_fallbacks=true
binary_format/64_bits=true
binary_format/embed_pck=false
custom_template/release=""
custom_template/debug=""
[preset.1] [preset.1]
@ -33,20 +34,21 @@ export_filter="all_resources"
include_filter="" include_filter=""
exclude_filter="" exclude_filter=""
export_path="../Builds/Windows/Client.exe" export_path="../Builds/Windows/Client.exe"
patch_list=PoolStringArray( )
script_export_mode=1 script_export_mode=1
script_encryption_key="" script_encryption_key=""
[preset.1.options] [preset.1.options]
custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=false
texture_format/bptc=false texture_format/bptc=false
texture_format/s3tc=true texture_format/s3tc=true
texture_format/etc=false texture_format/etc=false
texture_format/etc2=false texture_format/etc2=false
texture_format/no_bptc_fallbacks=true texture_format/no_bptc_fallbacks=true
binary_format/64_bits=true
binary_format/embed_pck=false
custom_template/release=""
custom_template/debug=""
codesign/enable=false codesign/enable=false
codesign/identity="" codesign/identity=""
codesign/password="" codesign/password=""

View File

@ -179,7 +179,6 @@ fallback="en_GB"
[physics] [physics]
3d/physics_engine="GodotPhysics"
3d/default_gravity=0.0 3d/default_gravity=0.0
[rendering] [rendering]