Kabuto and isolated TPSController

This commit is contained in:
Amazed 2021-10-15 23:42:06 +02:00
parent feb2bcc410
commit e97384825c
54 changed files with 62299 additions and 79 deletions

281
characters/kabuto.tscn Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
[gd_scene load_steps=11 format=2]
[ext_resource path="res://characters/latest_kabuto/kabuto.gltf" type="PackedScene" id=1]
[sub_resource type="AnimationNodeAnimation" id=1]
animation = "mutant punch-loop"
[sub_resource type="AnimationNodeBlend2" id=2]
filter_enabled = true
filters = [ "Armature/Skeleton:Head", "Armature/Skeleton:LeftArm", "Armature/Skeleton:LeftForeArm", "Armature/Skeleton:LeftHand", "Armature/Skeleton:LeftHandIndex1", "Armature/Skeleton:LeftHandIndex2", "Armature/Skeleton:LeftHandIndex3", "Armature/Skeleton:LeftShoulder", "Armature/Skeleton:Neck", "Armature/Skeleton:RightArm", "Armature/Skeleton:RightForeArm", "Armature/Skeleton:RightHand", "Armature/Skeleton:RightHandIndex1", "Armature/Skeleton:RightHandIndex2", "Armature/Skeleton:RightHandIndex3", "Armature/Skeleton:RightShoulder", "Armature/Skeleton:Spine", "Armature/Skeleton:Spine1", "Armature/Skeleton:Spine2" ]
[sub_resource type="AnimationNodeAnimation" id=3]
animation = "left strafe-loop"
[sub_resource type="AnimationNodeAnimation" id=4]
animation = "standard run-loop"
[sub_resource type="AnimationNodeAnimation" id=5]
animation = "right strafe-loop"
[sub_resource type="AnimationNodeAnimation" id=6]
animation = "standard run-loop"
[sub_resource type="AnimationNodeAnimation" id=7]
animation = "idle-loop"
[sub_resource type="AnimationNodeBlendSpace2D" id=8]
blend_point_0/node = SubResource( 3 )
blend_point_0/pos = Vector2( -1, 0 )
blend_point_1/node = SubResource( 4 )
blend_point_1/pos = Vector2( 0, 1 )
blend_point_2/node = SubResource( 5 )
blend_point_2/pos = Vector2( 1, 0 )
blend_point_3/node = SubResource( 6 )
blend_point_3/pos = Vector2( 0, -1 )
blend_point_4/node = SubResource( 7 )
blend_point_4/pos = Vector2( 0, 0 )
[sub_resource type="AnimationNodeBlendTree" id=9]
graph_offset = Vector2( -681.028, 65.5 )
nodes/Animation/node = SubResource( 1 )
nodes/Animation/position = Vector2( -360, 360 )
nodes/Blend2/node = SubResource( 2 )
nodes/Blend2/position = Vector2( 40, 260 )
nodes/movement/node = SubResource( 8 )
nodes/movement/position = Vector2( -340, 120 )
node_connections = [ "output", 0, "Blend2", "Blend2", 0, "movement", "Blend2", 1, "Animation" ]
[node name="kabuto" instance=ExtResource( 1 )]
[node name="AnimationTree" type="AnimationTree" parent="." index="2"]
tree_root = SubResource( 9 )
anim_player = NodePath("../AnimationPlayer")
active = true
parameters/Blend2/blend_amount = 0.0
parameters/movement/blend_position = Vector2( 0, 0 )

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -40,7 +40,7 @@ blend_point_4/node = SubResource( 7 )
blend_point_4/pos = Vector2( 0, -1 ) blend_point_4/pos = Vector2( 0, -1 )
[sub_resource type="AnimationNodeBlendTree" id=9] [sub_resource type="AnimationNodeBlendTree" id=9]
graph_offset = Vector2( 0, 65.5 ) graph_offset = Vector2( 0, 131 )
"nodes/Animation 2/node" = SubResource( 1 ) "nodes/Animation 2/node" = SubResource( 1 )
"nodes/Animation 2/position" = Vector2( 20, 340 ) "nodes/Animation 2/position" = Vector2( 20, 340 )
nodes/blend_draw/node = SubResource( 2 ) nodes/blend_draw/node = SubResource( 2 )
@ -118,11 +118,11 @@ visible = false
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0 ) transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0 )
[node name="lefthand" type="BoneAttachment" parent="Armature/Skeleton" index="1"] [node name="lefthand" type="BoneAttachment" parent="Armature/Skeleton" index="1"]
transform = Transform( 0.564253, 0.0541211, -0.823825, -0.598574, 0.714068, -0.363064, 0.568618, 0.697981, 0.435311, -1.42826, 5.04108, 1.28101 ) transform = Transform( 0.533259, 0.0320889, -0.845343, -0.614146, 0.701903, -0.360771, 0.581773, 0.711548, 0.394004, -1.5385, 5.02043, 1.17579 )
bone_name = "left_hand_index_4" bone_name = "left_hand_index_4"
[node name="righthand" type="BoneAttachment" parent="Armature/Skeleton" index="2"] [node name="righthand" type="BoneAttachment" parent="Armature/Skeleton" index="2"]
transform = Transform( -0.0680855, -0.709655, -0.70125, 0.192445, -0.699023, 0.688717, -0.978942, -0.0880606, 0.184163, 0.900404, 5.11416, -0.448968 ) transform = Transform( -0.0728095, -0.680585, -0.729042, 0.215094, -0.724495, 0.654859, -0.973875, -0.109132, 0.199139, 0.824623, 5.05023, -0.526535 )
bone_name = "right_hand_index_2" bone_name = "right_hand_index_2"
[node name="AnimationPlayer" parent="." index="9"] [node name="AnimationPlayer" parent="." index="9"]

View File

@ -16,6 +16,8 @@ weapon_refpt_right = NodePath("ReaperGLTF/Armature/Skeleton/righthand")
weapon_refpt_left = NodePath("ReaperGLTF/Armature/Skeleton/lefthand") weapon_refpt_left = NodePath("ReaperGLTF/Armature/Skeleton/lefthand")
water_splash_sound = ExtResource( 3 ) water_splash_sound = ExtResource( 3 )
animation_tree_path = NodePath("ReaperGLTF/AnimationTree") animation_tree_path = NodePath("ReaperGLTF/AnimationTree")
back_camera_path = NodePath("HeadPivot/SpringArm/BackCamera")
head_path = NodePath("HeadPivot")
sprint_speed = 250.0 sprint_speed = 250.0
deacceleration = 6 deacceleration = 6
air_control = 0.05 air_control = 0.05
@ -31,10 +33,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.524316, 0.123817, -0.842473, -0.658921, 0.685675, -0.309309, 0.539366, 0.717299, 0.441096, -1.57618, 5.07854, 1.16485 ) transform = Transform( 0.52524, 0.121386, -0.842251, -0.658248, 0.685222, -0.311738, 0.539289, 0.718148, 0.439809, -1.57497, 5.07708, 1.16144 )
[node name="righthand" parent="ReaperGLTF/Armature/Skeleton" index="2"] [node name="righthand" parent="ReaperGLTF/Armature/Skeleton" index="2"]
transform = Transform( 0.232014, -0.551311, -0.801389, 0.0601252, -0.814167, 0.577508, -0.970851, -0.182174, -0.155751, 1.20283, 5.04613, 0.0143257 ) transform = Transform( 0.231562, -0.548807, -0.803236, 0.0602912, -0.815995, 0.574906, -0.970949, -0.181554, -0.155865, 1.19905, 5.04342, 0.0130773 )
[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 )
@ -44,4 +46,15 @@ root_node = NodePath("../ReaperGLTF")
playback_speed = 0.2 playback_speed = 0.2
"anims/standing run forward-loop" = ExtResource( 6 ) "anims/standing run forward-loop" = ExtResource( 6 )
[node name="HeadPivot" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8, -1 )
[node name="SpringArm" type="SpringArm" parent="HeadPivot"]
spring_length = 10.0
margin = 1.0
[node name="BackCamera" type="Camera" parent="HeadPivot/SpringArm"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.398, 11.737 )
far = 8192.0
[editable path="ReaperGLTF"] [editable path="ReaperGLTF"]

View File

@ -3,20 +3,40 @@
[ext_resource path="res://entities/character.gd" type="Script" id=1] [ext_resource path="res://entities/character.gd" type="Script" id=1]
[ext_resource path="res://assets/all_gbs/vp_l1.gbs.obj" type="ArrayMesh" id=2] [ext_resource path="res://assets/all_gbs/vp_l1.gbs.obj" type="ArrayMesh" id=2]
[sub_resource type="BoxShape" id=1] [sub_resource type="CapsuleShape" id=1]
extents = Vector3( 4, 10, 7 ) radius = 8.0
height = 6.0
[node name="Vimp" type="KinematicBody"] [node name="Vimp" type="KinematicBody"]
collision_layer = 2
script = ExtResource( 1 ) script = ExtResource( 1 )
max_weapons = 0 max_weapons = 0
back_camera_path = NodePath("Spatial/SpringArm/BackCamera")
head_path = NodePath("Spatial")
sprint_speed = 50.0
air_control = 0.05
can_jump = false
gravity = 200.0
walk_speed = 20.0
[node name="MeshInstance" type="MeshInstance" parent="."] [node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 ) transform = Transform( -1, 8.74228e-08, 3.82137e-15, 0, -4.37114e-08, 1, 8.74228e-08, 1, 4.37114e-08, 0, 0, 0 )
mesh = ExtResource( 2 ) mesh = ExtResource( 2 )
material/0 = null material/0 = null
material/1 = null material/1 = null
material/2 = null material/2 = null
[node name="CollisionShape" type="CollisionShape" parent="."] [node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 2 ) transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 11, 0 )
shape = SubResource( 1 ) shape = SubResource( 1 )
[node name="Spatial" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 17, -7 )
[node name="SpringArm" type="SpringArm" parent="Spatial"]
spring_length = 50.0
margin = 1.0
[node name="BackCamera" type="Camera" parent="Spatial/SpringArm"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 22.846, 34.344 )
far = 8192.0

View File

@ -22,7 +22,6 @@ signal fired(projectile)
signal pickup_weapon signal pickup_weapon
signal jumped signal jumped
var UI: Control
export var max_weapons: int = 5 export var max_weapons: int = 5
var weapons: Array = [] var weapons: Array = []
var current_weapon: Weapon var current_weapon: Weapon
@ -33,6 +32,10 @@ export var water_splash_sound: AudioStreamSample
var animation_blend_vector = Vector2.ZERO var animation_blend_vector = Vector2.ZERO
export var animation_tree_path: NodePath export var animation_tree_path: NodePath
var animation_tree: AnimationTree var animation_tree: AnimationTree
export var back_camera_path: NodePath
onready var back_camera = get_node(back_camera_path)
export var head_path: NodePath
onready var head = get_node(head_path)
# Move # Move
@ -51,6 +54,8 @@ export var floor_max_angle := 90.0
export var gravity: float = 40.0 export var gravity: float = 40.0
export var walk_speed: float = 2.0 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
var ground_snap = Vector3.DOWN
var ground_type = GroundType.DIRT var ground_type = GroundType.DIRT
@ -166,35 +171,29 @@ func _physics_process(delta):
if not animation_tree: if not animation_tree:
return return
if not Globals.process_3d_inputs:
return
# Blend nicely between animations # Blend nicely between animations
var movement_vector = Vector2.ZERO var anim_vector = Vector2(move_axis.y, move_axis.x)
if Input.is_action_pressed("move_forward"): var res = animation_blend_vector.linear_interpolate(anim_vector, delta*animation_blend_speed)
movement_vector.y = 1
if Input.is_action_pressed("move_backward"):
movement_vector.y = -1
if Input.is_action_pressed("move_right"):
movement_vector.x = 1
if Input.is_action_pressed("move_left"):
movement_vector.x = -1
var res = animation_blend_vector.linear_interpolate(movement_vector, delta*10)
animation_tree.set("parameters/movement/blend_position", res) animation_tree.set("parameters/movement/blend_position", res)
animation_blend_vector = res animation_blend_vector = res
func _process(delta):
if Engine.editor_hint:
return
if Globals.process_3d_inputs:
move_axis.x = Input.get_action_strength("move_forward") - Input.get_action_strength("move_backward")
move_axis.y = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
take_damage(0.1)
func fire_pressed(): func fire_pressed():
current_weapon.activate(Globals.target_position["position"]) if current_weapon:
current_weapon.activate(Globals.target_position["position"])
func fire_released(): func fire_released():
current_weapon.deactivate(Globals.target_position["position"]) if current_weapon:
current_weapon.deactivate(Globals.target_position["position"])
func jump():
if can_jump and is_on_floor():
velocity.y = jump_height
emit_signal("jumped")
func set_sprint(state: bool):
if can_sprint:
sprinting = state
func walk(delta: float) -> void: func walk(delta: float) -> void:
# Input # Input
@ -211,15 +210,6 @@ func walk(delta: float) -> void:
direction.y = 0 direction.y = 0
direction = direction.normalized() direction = direction.normalized()
# Jump
var _snap: Vector3
if can_jump and is_on_floor():
_snap = Vector3.DOWN
if Input.is_action_just_pressed("move_jump"):
_snap = Vector3.ZERO
velocity.y = jump_height
emit_signal("jumped")
# Apply Gravity # Apply Gravity
velocity.y -= gravity * delta velocity.y -= gravity * delta
# if is_in_water: # if is_in_water:
@ -227,12 +217,11 @@ func walk(delta: float) -> void:
# Sprint # Sprint
var _speed: float var _speed: float
if Globals.process_3d_inputs and Input.is_action_pressed("move_sprint") and can_sprint and move_axis.x == 1: if sprinting:
# if can_sprint and move_axis.x == 1:
_speed = sprint_speed _speed = sprint_speed
sprinting = true
else: else:
_speed = walk_speed _speed = walk_speed
sprinting = false
# Acceleration and Deacceleration # Acceleration and Deacceleration
# where would the player go # where would the player go

View File

@ -1,28 +1,47 @@
extends Spatial extends Spatial
class_name TPSController class_name TPSController
export var character_scene: PackedScene # debug camera
var character: Character export var reaper_path: NodePath
export var vimp_path: NodePath
export var character_path: NodePath
onready var character: Character = get_node(character_path)
var head: Spatial
var cam: Camera
var default_camera_trans: Transform
var is_in_menu: bool = false var is_in_menu: bool = false
onready var cam = $Head/SpringArm/Camera
onready var default_camera_trans = cam.transform
export var FOV = 80.0 export var FOV = 80.0
export var HUD_scene: PackedScene export var HUD_scene: PackedScene
onready var HUD: Control onready var HUD: Control
onready var debug_label = $DebugText onready var debug_label: Label = $DebugText
var mouse_axis: Vector2 = Vector2.ZERO var mouse_axis: Vector2 = Vector2.ZERO
export var mouse_sensitivity = 10.0 export var mouse_sensitivity: float = 10.0
onready var head = $Head var cursor_no_enemy: Control
var cursor_enemy: Control
func set_character(c: Character):
if cam:
cam.current = false
character = c
cam = character.back_camera
default_camera_trans = cam.transform
head = character.head
cam.fov = FOV
cam.current = true
func _ready(): func _ready():
cam.fov = FOV set_character(character)
if not Engine.editor_hint: if not Engine.editor_hint:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
HUD = HUD_scene.instance() HUD = HUD_scene.instance()
add_child(HUD) add_child(HUD)
character = character_scene.instance()
add_child(character)
character.connect("health_changed", self, "update_health") character.connect("health_changed", self, "update_health")
if HUD.has_node("cursor_enemy"):
cursor_enemy = HUD.get_node("cursor_enemy")
if HUD.has_node("cursor_no_enemy"):
cursor_enemy = HUD.get_node("cursor_no_enemy")
func get_target() -> Dictionary: func get_target() -> Dictionary:
var weapon = character.current_weapon var weapon = character.current_weapon
@ -46,19 +65,20 @@ func _physics_process(delta):
Globals.target_position = target Globals.target_position = target
# cursor change # cursor change
if target["collider"] and target["collider"] is Entity: if cursor_no_enemy and cursor_enemy:
HUD.get_node("cursor_no_enemy").visible = false if target["collider"] and target["collider"] is Entity:
HUD.get_node("cursor_enemy").visible = true cursor_no_enemy.visible = false
else: cursor_enemy.visible = true
HUD.get_node("cursor_enemy").visible = false else:
HUD.get_node("cursor_no_enemy").visible = true cursor_enemy.visible = false
cursor_no_enemy.visible = true
# update camera # update camera
if character.sprinting: if character.sprinting:
cam.set_fov(lerp(cam.fov, FOV * 1.2, delta * 8)) cam.set_fov(lerp(cam.fov, FOV * 1.2, delta * 8))
else: else:
cam.set_fov(lerp(cam.fov, FOV, delta * 8)) cam.set_fov(lerp(cam.fov, FOV, delta * 8))
head.global_transform.origin = character.global_transform.origin # head.global_transform.origin = character.global_transform.origin
func camera_rotation() -> void: func camera_rotation() -> void:
@ -73,7 +93,10 @@ func camera_rotation() -> void:
character.rotate_y(deg2rad(horizontal)) character.rotate_y(deg2rad(horizontal))
var temp_rot: Vector3 = head.rotation_degrees var temp_rot: Vector3 = head.rotation_degrees
temp_rot += Vector3(vertical, horizontal, 0) temp_rot += Vector3(vertical, 0, 0)
# temp_rot += Vector3(vertical, horizontal, 0)
# clamp vertical rotation
temp_rot.x = clamp(temp_rot.x, -75, 75) temp_rot.x = clamp(temp_rot.x, -75, 75)
head.rotation_degrees = temp_rot head.rotation_degrees = temp_rot
@ -108,6 +131,21 @@ func _input(event: InputEvent) -> void:
add_child(ingame_menu) add_child(ingame_menu)
ingame_menu.connect("tree_exited", self, "_ingamemenu_closed") ingame_menu.connect("tree_exited", self, "_ingamemenu_closed")
Globals.process_3d_inputs = false Globals.process_3d_inputs = false
if Input.is_action_just_pressed("camera_reaper"):
set_character(get_node(reaper_path))
if Input.is_action_just_pressed("camera_vimp"):
set_character(get_node(vimp_path))
if Input.is_action_just_pressed("move_jump"):
character.jump()
if Input.is_action_just_pressed("move_sprint"):
character.set_sprint(true)
if Input.is_action_just_released("move_sprint"):
character.set_sprint(false)
func _ingamemenu_closed(): func _ingamemenu_closed():
Globals.process_3d_inputs = true Globals.process_3d_inputs = true
@ -118,10 +156,15 @@ func _process(_delta: float) -> void:
return return
if Globals.process_3d_inputs: if Globals.process_3d_inputs:
camera_rotation() camera_rotation()
character.move_axis.x = Input.get_action_strength("move_forward") - Input.get_action_strength("move_backward")
character.move_axis.y = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
update_hud() update_hud()
func update_hud() -> void: func update_hud() -> void:
# for weapon_slot in HUD.find_node("Weapon*"):
# for child in weapon_slot.get_children():
# weapon_slot.remove_child(child)
for weapon in character.weapons: for weapon in character.weapons:
var weapon_slot = character.get_weapon_slot(weapon) var weapon_slot = character.get_weapon_slot(weapon)
var hud_weapon_slot = HUD.find_node("Weapon%s" % weapon_slot) var hud_weapon_slot = HUD.find_node("Weapon%s" % weapon_slot)

View File

@ -9,6 +9,7 @@ script = ExtResource( 1 )
HUD_scene = ExtResource( 2 ) HUD_scene = ExtResource( 2 )
[node name="Head" type="Spatial" parent="."] [node name="Head" type="Spatial" parent="."]
visible = false
[node name="SpringArm" type="SpringArm" parent="Head"] [node name="SpringArm" type="SpringArm" parent="Head"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 5 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 5 )
@ -17,7 +18,6 @@ margin = 1.0
[node name="Camera" type="Camera" parent="Head/SpringArm"] [node name="Camera" type="Camera" parent="Head/SpringArm"]
environment = ExtResource( 3 ) environment = ExtResource( 3 )
current = true
near = 0.01 near = 0.01
far = 8192.0 far = 8192.0

View File

@ -139,6 +139,16 @@ move_sprint={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"unicode":0,"echo":false,"script":null)
] ]
} }
camera_vimp={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":233,"unicode":0,"echo":false,"script":null)
]
}
camera_reaper={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":38,"unicode":0,"echo":false,"script":null)
]
}
[layer_names] [layer_names]

View File

@ -1,6 +1,10 @@
extends Spatial extends Spatial
tool tool
onready var vimp = $Vimp
onready var player = $PlayerController.character
onready var nav = $Navigation
func dict_of_lowercase_filenames(path): func dict_of_lowercase_filenames(path):
var dir_files = {} var dir_files = {}
var dirpath = path var dirpath = path
@ -47,8 +51,8 @@ func _ready():
var assets_files = dict_of_lowercase_filenames("res://assets/all_gbs") var assets_files = dict_of_lowercase_filenames("res://assets/all_gbs")
var audio_files = dict_of_lowercase_filenames("res://assets/audio/Stream/Ambient") var audio_files = dict_of_lowercase_filenames("res://assets/audio/Stream/Ambient")
var ids = load_json_file("res://assets/id_to_gbs.json") var ids = load_json_file("res://assets/id_to_gbs.json")
print("Loaded %s valid objects" % len(ids)) #print("Loaded %s valid objects" % len(ids))
print("Godot found %s GBS available to load" % str(len(assets_files))) #print("Godot found %s GBS available to load" % str(len(assets_files)))
var map_objs = load_json_file("res://assets/terrains/square_one_1/w_M_3Way_Tigs - Threeway - Square One.bin.txt.json") var map_objs = load_json_file("res://assets/terrains/square_one_1/w_M_3Way_Tigs - Threeway - Square One.bin.txt.json")
#var map_origin = $MeshInstance.global_transform.origin #var map_origin = $MeshInstance.global_transform.origin
#var map_stretch = 1 #var map_stretch = 1
@ -109,5 +113,11 @@ func _ready():
audiostream.bus = "Ambiants" audiostream.bus = "Ambiants"
mesh_instance.add_child(audiostream) mesh_instance.add_child(audiostream)
func _process(_delta): func _on_Timer_timeout():
pass var path = nav.get_simple_path(vimp.global_transform.origin, player.global_transform.origin, true)
if path:
var direction = path[0] - vimp.translation
vimp.move_axis = direction.normalized()
vimp.walk(0.01)
path.remove(0)

File diff suppressed because one or more lines are too long

56
ui/empty_ui.tscn Normal file
View File

@ -0,0 +1,56 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://assets/all_gbs/textures/st_mec_energy.tga" type="Texture" id=1]
[ext_resource path="res://assets/all_gbs/textures/st_mecc_xhair.tga" type="Texture" id=4]
[sub_resource type="Gradient" id=1]
colors = PoolColorArray( 1, 0, 0, 1, 1, 1, 1, 0.046729 )
[sub_resource type="GradientTexture" id=2]
gradient = SubResource( 1 )
width = 10
[node name="UI" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 2.0
margin_right = 2.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="hp" type="Polygon2D" parent="."]
position = Vector2( 957.76, 325.233 )
color = Color( 1, 0, 0, 1 )
offset = Vector2( -31.7015, 28.4404 )
texture = SubResource( 2 )
texture_rotation_degrees = 90.0
polygon = PoolVector2Array( 4.07648, -12.0231, 5.19122, -17.9239, 8.9613, -23.6782, 12.533, -26.3569, 15.8069, -28.0435, 20.966, -27.5475, 23.9424, -24.3727, 27.1172, -19.6105, 29.1014, -14.5507, 29.9944, -10.1853, 31.2841, -7.10971, 34.4589, -12.7648, 35.3519, -16.7333, 37.9314, -21.1979, 40.0148, -25.0672, 42.6935, -27.4483, 47.0589, -28.4404, 52.8132, -27.1506, 54.103, -25.8609, 57.8731, -20.1066, 59.7581, -14.6499, 60.9487, -7.70499, 61.3455, 2.51392, 61.2463, 12.336, 60.155, 18.5864, 48.9894, 80.8738, 39.2252, 135.995, 31.9805, 202.456, 25.051, 136.625, 13.7117, 70.7945, 2.68756, 13.468, 2.05756, -1.33612 )
[node name="healthbar" type="TextureRect" parent="."]
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -97.9412
margin_top = -281.782
margin_right = -33.9412
margin_bottom = -25.7818
texture = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="smallcursor" type="TextureRect" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -20.0
margin_top = -20.0
margin_right = 20.0
margin_bottom = 20.0
texture = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}