felix raider stuff
This commit is contained in:
parent
002e6ae41c
commit
e1f8b60606
73
experimente/felox/player.gd
Normal file
73
experimente/felox/player.gd
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
extends CharacterBody3D
|
||||||
|
class_name Player
|
||||||
|
|
||||||
|
var input_dir := Vector2.ZERO
|
||||||
|
@onready var animation_tree: AnimationTree = $AnimationTree
|
||||||
|
@onready var pelvis: Node3D = $Node/base/pelvis
|
||||||
|
var not_dead := true
|
||||||
|
|
||||||
|
#@onready var weapon_slot_2: Area3D = $WeaponSlot2
|
||||||
|
#@onready var weapon_slot: Area3D = $WeaponSlot
|
||||||
|
@onready var collision_shape_3d: CollisionShape3D = $CollisionShape3D
|
||||||
|
#@onready var player_hit_box: Area3D = $PlayerHitBox
|
||||||
|
@onready var node: Node3D = $Node
|
||||||
|
#@onready var explosion: Node3D = $Explosion
|
||||||
|
#@onready var audio_stream_player: AudioStreamPlayer = $AudioStreamPlayer
|
||||||
|
|
||||||
|
@export_multiline var death_message : Array[String]
|
||||||
|
#@onready var color_rect: ColorRect = $CanvasLayer/ColorRect
|
||||||
|
|
||||||
|
func handle_dying():
|
||||||
|
not_dead = false
|
||||||
|
#weapon_slot_2.queue_free()
|
||||||
|
#weapon_slot.queue_free()
|
||||||
|
collision_shape_3d.queue_free()
|
||||||
|
#player_hit_box.queue_free()
|
||||||
|
node.queue_free()
|
||||||
|
#explosion.play()
|
||||||
|
#HudSignalBus.roll_dialog.emit(death_message)
|
||||||
|
#audio_stream_player.play()
|
||||||
|
#get_tree().create_tween().tween_property(color_rect, "color", Color.BLACK, 5)
|
||||||
|
#get_tree().create_timer(5).timeout.connect(foo)
|
||||||
|
|
||||||
|
func handle_animations():
|
||||||
|
if !not_dead:
|
||||||
|
return
|
||||||
|
animation_tree.set("parameters/walk_timescale/scale", (velocity.length())/3)
|
||||||
|
|
||||||
|
if velocity.length() > 0.1:
|
||||||
|
pelvis.look_at(global_position+velocity)
|
||||||
|
pelvis.rotation.x = 0
|
||||||
|
pelvis.rotation.z = 0
|
||||||
|
|
||||||
|
if velocity.length() < 0.1 and animation_tree.get("parameters/idle_walk_blend/blend_amount") >= 1:
|
||||||
|
var tween = get_tree().create_tween()
|
||||||
|
tween.tween_property(animation_tree, "parameters/idle_walk_blend/blend_amount", 0, .5)
|
||||||
|
#tween.connect("finished", $FootSoundPlayer.play)
|
||||||
|
|
||||||
|
if (velocity.length()) > 0.1 and animation_tree.get("parameters/idle_walk_blend/blend_amount") == 0:
|
||||||
|
var tween = get_tree().create_tween()
|
||||||
|
tween.tween_property(animation_tree, "parameters/idle_walk_blend/blend_amount", 1, .5)
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
|
||||||
|
|
||||||
|
handle_animations()
|
||||||
|
|
||||||
|
var asd = Vector2.ZERO
|
||||||
|
if not_dead:
|
||||||
|
if Input.is_action_just_pressed("shoot3"):
|
||||||
|
handle_dying()
|
||||||
|
|
||||||
|
asd = Input.get_vector("strafe_left", "strafe_right", "move_front", "move_back")*5
|
||||||
|
rotation.y -= delta*Input.get_axis("turn_left","turn_right")*2
|
||||||
|
|
||||||
|
input_dir = lerp(input_dir, asd, .1)
|
||||||
|
|
||||||
|
var input_velocity = Vector3(input_dir.x, 0, input_dir.y).rotated(Vector3.UP, rotation.y)
|
||||||
|
velocity.x = input_velocity.x
|
||||||
|
velocity.z = input_velocity.z
|
||||||
|
velocity = velocity + Vector3.DOWN*1
|
||||||
|
|
||||||
|
|
||||||
|
move_and_slide()
|
||||||
41
experimente/felox/player.tscn
Normal file
41
experimente/felox/player.tscn
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
[gd_scene load_steps=9 format=3 uid="uid://dycbdcrwsm6wu"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://blgpm2l7pjv3c" path="res://experimente/felox/policerobot.gltf" id="1_owk8q"]
|
||||||
|
[ext_resource type="Script" path="res://experimente/felox/player.gd" id="2_t64b8"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jdpq0"]
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_7g8sn"]
|
||||||
|
animation = &"walk"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_yeox8"]
|
||||||
|
animation = &"idle"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_5u74v"]
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_4ktf5"]
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_g5r8j"]
|
||||||
|
nodes/Animation/node = SubResource("AnimationNodeAnimation_yeox8")
|
||||||
|
nodes/Animation/position = Vector2(500, 80)
|
||||||
|
"nodes/Animation 2/node" = SubResource("AnimationNodeAnimation_7g8sn")
|
||||||
|
"nodes/Animation 2/position" = Vector2(500, 280)
|
||||||
|
nodes/idle_walk_blend/node = SubResource("AnimationNodeBlend2_5u74v")
|
||||||
|
nodes/idle_walk_blend/position = Vector2(960, 60)
|
||||||
|
nodes/output/position = Vector2(1180, 140)
|
||||||
|
nodes/walk_timescale/node = SubResource("AnimationNodeTimeScale_4ktf5")
|
||||||
|
nodes/walk_timescale/position = Vector2(780, 320)
|
||||||
|
node_connections = [&"idle_walk_blend", 0, &"Animation", &"idle_walk_blend", 1, &"walk_timescale", &"output", 0, &"idle_walk_blend", &"walk_timescale", 0, &"Animation 2"]
|
||||||
|
|
||||||
|
[node name="player" instance=ExtResource("1_owk8q")]
|
||||||
|
script = ExtResource("2_t64b8")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="." index="2"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||||
|
shape = SubResource("CapsuleShape3D_jdpq0")
|
||||||
|
|
||||||
|
[node name="AnimationTree" type="AnimationTree" parent="." index="3"]
|
||||||
|
tree_root = SubResource("AnimationNodeBlendTree_g5r8j")
|
||||||
|
anim_player = NodePath("../AnimationPlayer")
|
||||||
|
parameters/idle_walk_blend/blend_amount = 0.0
|
||||||
|
parameters/walk_timescale/scale = 1.0
|
||||||
1
experimente/felox/policerobot.gltf
Normal file
1
experimente/felox/policerobot.gltf
Normal file
File diff suppressed because one or more lines are too long
1838
experimente/felox/policerobot.gltf.import
Normal file
1838
experimente/felox/policerobot.gltf.import
Normal file
File diff suppressed because it is too large
Load Diff
BIN
experimente/felox/policerobot_0.png
Normal file
BIN
experimente/felox/policerobot_0.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
37
experimente/felox/policerobot_0.png.import
Normal file
37
experimente/felox/policerobot_0.png.import
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://fg3il4fikkrj"
|
||||||
|
path="res://.godot/imported/policerobot_0.png-16cb9f651ec03e1fa7a6d338edee280c.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
generator_parameters={
|
||||||
|
"md5": "dfa09b1d58b47e26ffd51ba9c2ca4277"
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://experimente/felox/policerobot_0.png"
|
||||||
|
dest_files=["res://.godot/imported/policerobot_0.png-16cb9f651ec03e1fa7a6d338edee280c.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=3
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
||||||
35
experimente/felox/testmap.tscn
Normal file
35
experimente/felox/testmap.tscn
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://8n0yh5w2lgr6"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dycbdcrwsm6wu" path="res://experimente/felox/player.tscn" id="1_6401j"]
|
||||||
|
|
||||||
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_or7bv"]
|
||||||
|
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||||
|
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||||
|
|
||||||
|
[sub_resource type="Sky" id="Sky_act4e"]
|
||||||
|
sky_material = SubResource("ProceduralSkyMaterial_or7bv")
|
||||||
|
|
||||||
|
[sub_resource type="Environment" id="Environment_5ukdt"]
|
||||||
|
background_mode = 2
|
||||||
|
sky = SubResource("Sky_act4e")
|
||||||
|
tonemap_mode = 2
|
||||||
|
glow_enabled = true
|
||||||
|
|
||||||
|
[node name="testmap" type="Node3D"]
|
||||||
|
|
||||||
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
|
transform = Transform3D(-0.866025, -0.433013, 0.25, 0, 0.5, 0.866025, -0.5, 0.75, -0.433013, 0, 0, 0)
|
||||||
|
shadow_enabled = true
|
||||||
|
|
||||||
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
|
environment = SubResource("Environment_5ukdt")
|
||||||
|
|
||||||
|
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(100, 1, 100)
|
||||||
|
|
||||||
|
[node name="player" parent="." instance=ExtResource("1_6401j")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.628725, 0)
|
||||||
|
|
||||||
|
[node name="Camera3D" type="Camera3D" parent="player"]
|
||||||
|
transform = Transform3D(0.999815, 0.0128588, -0.014304, 0, 0.743677, 0.668539, 0.0192342, -0.668415, 0.74354, 0, 7, 3)
|
||||||
@ -13,3 +13,36 @@ config_version=5
|
|||||||
config/name="RAIDER_Survivor"
|
config/name="RAIDER_Survivor"
|
||||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
strafe_left={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
strafe_right={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
move_back={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
move_front={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
turn_left={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
turn_right={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user