WIP: player markers

This commit is contained in:
Amazed 2021-10-19 00:20:29 +02:00
parent af2cb1caa0
commit 38df9d27b9
7 changed files with 52 additions and 16 deletions

View File

@ -2,33 +2,35 @@
importer="texture" importer="texture"
type="StreamTexture" type="StreamTexture"
path="res://.import/ID_foe.tga-35eecbb6478ade0bcbadd3e21c6410dc.stex" path.s3tc="res://.import/ID_foe.tga-35eecbb6478ade0bcbadd3e21c6410dc.s3tc.stex"
path.etc2="res://.import/ID_foe.tga-35eecbb6478ade0bcbadd3e21c6410dc.etc2.stex"
metadata={ metadata={
"vram_texture": false "imported_formats": [ "s3tc", "etc2" ],
"vram_texture": true
} }
[deps] [deps]
source_file="res://assets/all_gbs/textures/ID_foe.tga" source_file="res://assets/all_gbs/textures/ID_foe.tga"
dest_files=[ "res://.import/ID_foe.tga-35eecbb6478ade0bcbadd3e21c6410dc.stex" ] dest_files=[ "res://.import/ID_foe.tga-35eecbb6478ade0bcbadd3e21c6410dc.s3tc.stex", "res://.import/ID_foe.tga-35eecbb6478ade0bcbadd3e21c6410dc.etc2.stex" ]
[params] [params]
compress/mode=0 compress/mode=2
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_mode=0 compress/hdr_mode=0
compress/bptc_ldr=0 compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
flags/repeat=0 flags/repeat=true
flags/filter=true flags/filter=true
flags/mipmaps=false flags/mipmaps=true
flags/anisotropic=false flags/anisotropic=false
flags/srgb=2 flags/srgb=1
process/fix_alpha_border=true process/fix_alpha_border=true
process/premult_alpha=false process/premult_alpha=false
process/HDR_as_SRGB=false process/HDR_as_SRGB=false
process/invert_color=false process/invert_color=false
stream=false stream=false
size_limit=0 size_limit=0
detect_3d=true detect_3d=false
svg/scale=1.0 svg/scale=1.0

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=2] [gd_scene load_steps=17 format=2]
[ext_resource path="res://characters/kabuto.gd" type="Script" id=1] [ext_resource path="res://characters/kabuto.gd" type="Script" id=1]
[ext_resource path="res://characters/latest_kabuto/kabuto.tscn" type="PackedScene" id=2] [ext_resource path="res://characters/latest_kabuto/kabuto.tscn" type="PackedScene" id=2]
@ -9,6 +9,7 @@
[ext_resource path="res://characters/latest_kabuto/k_hornmat.material" type="Material" id=7] [ext_resource path="res://characters/latest_kabuto/k_hornmat.material" type="Material" id=7]
[ext_resource path="res://characters/latest_kabuto/k_headmat.material" type="Material" id=8] [ext_resource path="res://characters/latest_kabuto/k_headmat.material" type="Material" id=8]
[ext_resource path="res://characters/latest_kabuto/k_left_armmat.material" type="Material" id=9] [ext_resource path="res://characters/latest_kabuto/k_left_armmat.material" type="Material" id=9]
[ext_resource path="res://ui/player_marker.tscn" type="PackedScene" id=10]
[ext_resource path="res://characters/latest_kabuto/k_torsomat.material" type="Material" id=40] [ext_resource path="res://characters/latest_kabuto/k_torsomat.material" type="Material" id=40]
[ext_resource path="res://characters/latest_kabuto/k_shouldermat.material" type="Material" id=41] [ext_resource path="res://characters/latest_kabuto/k_shouldermat.material" type="Material" id=41]
[ext_resource path="res://characters/latest_kabuto/k_right_legmat.material" type="Material" id=42] [ext_resource path="res://characters/latest_kabuto/k_right_legmat.material" type="Material" id=42]
@ -279,4 +280,8 @@ margin = 1.0
transform = Transform( 0.025, 0, 0, 0, 0.025, 0, 0, 0, 0.025, 0, 0.199245, 0.991495 ) transform = Transform( 0.025, 0, 0, 0, 0.025, 0, 0, 0, 0.025, 0, 0.199245, 0.991495 )
far = 8192.0 far = 8192.0
[node name="MeshInstance" parent="headpivot" instance=ExtResource( 10 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3368, 0 )
visible = false
[editable path="kabuto2"] [editable path="kabuto2"]

View File

@ -32,10 +32,10 @@ shape = SubResource( 1 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.611, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.611, 0 )
[node name="lefthand" parent="ReaperGLTF/Armature/Skeleton" index="1"] [node name="lefthand" parent="ReaperGLTF/Armature/Skeleton" index="1"]
transform = Transform( 0.528845, 0.104264, -0.84229, -0.658084, 0.677079, -0.329376, 0.535954, 0.728487, 0.426685, -1.56829, 5.06479, 1.12625 ) transform = Transform( 0.508859, 0.108764, -0.853951, -0.671381, 0.671024, -0.314602, 0.538804, 0.733414, 0.414479, -1.6122, 5.06824, 1.0584 )
[node name="righthand" parent="ReaperGLTF/Armature/Skeleton" index="2"] [node name="righthand" parent="ReaperGLTF/Armature/Skeleton" index="2"]
transform = Transform( 0.225415, -0.578802, -0.783693, 0.0687161, -0.792948, 0.605402, -0.971836, -0.190319, -0.138969, 1.1485, 5.01285, -0.0293284 ) transform = Transform( 0.227968, -0.422535, -0.877208, 0.14318, -0.876589, 0.459446, -0.963083, -0.230338, -0.139336, 1.10256, 4.97003, -0.15456 )
[node name="AnimationTree" parent="ReaperGLTF" index="10"] [node name="AnimationTree" parent="ReaperGLTF" index="10"]
parameters/movement/blend_position = Vector2( 0, 0 ) parameters/movement/blend_position = Vector2( 0, 0 )

View File

@ -35,7 +35,8 @@ var animation_tree: AnimationTree
export var back_camera_path: NodePath export var back_camera_path: NodePath
onready var back_camera = get_node(back_camera_path) onready var back_camera = get_node(back_camera_path)
export var head_path: NodePath export var head_path: NodePath
onready var head = get_node(head_path) onready var head: Spatial = get_node(head_path)
var marker: MeshInstance
# Move # Move
@ -56,6 +57,7 @@ export var walk_speed: float = 2.0
export var ground_friction: float = 3.0 export var ground_friction: float = 3.0
export var animation_blend_speed: float = 10 export var animation_blend_speed: float = 10
var ground_snap = Vector3.DOWN var ground_snap = Vector3.DOWN
export var has_marker: bool = false
var ground_type = GroundType.DIRT var ground_type = GroundType.DIRT
@ -81,6 +83,13 @@ func get_similar_weapon(weapon: Weapon) -> Weapon:
func can_pickup_weapon(weapon: Weapon) -> bool: func can_pickup_weapon(weapon: Weapon) -> bool:
return has_weapon(weapon) or len(weapons) < max_weapons return has_weapon(weapon) or len(weapons) < max_weapons
func can_see(other_character: Character) -> bool:
var ray = RayCast.new()
ray.translation = head.translation
ray.cast_to(other_character.head)
var collider = ray.get_collider()
return collider == other_character.head
func can_shoot_delay() -> bool: func can_shoot_delay() -> bool:
# returns true if the character has not shot a bullet recently # returns true if the character has not shot a bullet recently
return shoot_delay <= 0 return shoot_delay <= 0
@ -176,6 +185,11 @@ func exit_water(force: float):
func _ready(): func _ready():
if animation_tree_path: if animation_tree_path:
animation_tree = get_node(animation_tree_path) animation_tree = get_node(animation_tree_path)
if has_marker:
marker = preload("res://ui/player_marker.tscn").instance()
head.add_child(marker)
marker.transform.origin = Vector3(0, 0.337, 0)
marker.mesh.size = Vector2.ONE * 5
func _process(delta): func _process(delta):
if shoot_delay > 0: if shoot_delay > 0:

View File

@ -120,8 +120,6 @@ func angle_between(a: Vector3, b: Vector3) -> float:
angle = (int(angle) + 90) % 360 angle = (int(angle) + 90) % 360
return float(angle) return float(angle)
onready var tween = get_node("Tween")
func _physics_process(delta): func _physics_process(delta):
if player.translation.distance_to(last_target_position) > 10: if player.translation.distance_to(last_target_position) > 10:
last_target_position = player.translation last_target_position = player.translation

View File

@ -653,6 +653,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1473, 34, 759 )
[node name="Kabuto" parent="." instance=ExtResource( 13 )] [node name="Kabuto" parent="." instance=ExtResource( 13 )]
transform = Transform( 50, 0, 0, 0, 50, 0, 0, 0, 50, 1465, 30, 712 ) transform = Transform( 50, 0, 0, 0, 50, 0, 0, 0, 50, 1465, 30, 712 )
has_marker = true
[node name="PlayerController" parent="." instance=ExtResource( 9 )] [node name="PlayerController" parent="." instance=ExtResource( 9 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1469.2, 232.516, 687.363 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1469.2, 232.516, 687.363 )
@ -660,6 +661,4 @@ reaper_path = NodePath("../Reaper")
vimp_path = NodePath("../Vimp") vimp_path = NodePath("../Vimp")
character_path = NodePath("../Reaper") character_path = NodePath("../Reaper")
[node name="Tween" type="Tween" parent="."]
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] [connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]

18
ui/player_marker.tscn Normal file
View File

@ -0,0 +1,18 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/all_gbs/textures/ID_foe.tga" type="Texture" id=1]
[sub_resource type="SpatialMaterial" id=1]
flags_transparent = true
flags_unshaded = true
params_cull_mode = 2
params_billboard_mode = 1
albedo_texture = ExtResource( 1 )
[sub_resource type="QuadMesh" id=2]
material = SubResource( 1 )
size = Vector2( 5, 5 )
[node name="MeshInstance" type="MeshInstance"]
mesh = SubResource( 2 )
material/0 = null