generated from Persson-dev/Godot-Xmake
third persson prototype
This commit is contained in:
BIN
godot/Assets/Animations/Air.fbx
LFS
Normal file
BIN
godot/Assets/Animations/Air.fbx
LFS
Normal file
Binary file not shown.
BIN
godot/Assets/Animations/Idle.fbx
LFS
Normal file
BIN
godot/Assets/Animations/Idle.fbx
LFS
Normal file
Binary file not shown.
BIN
godot/Assets/Animations/Run.fbx
LFS
Normal file
BIN
godot/Assets/Animations/Run.fbx
LFS
Normal file
Binary file not shown.
BIN
godot/Assets/Animations/T-Pose.fbx
LFS
Normal file
BIN
godot/Assets/Animations/T-Pose.fbx
LFS
Normal file
Binary file not shown.
BIN
godot/Assets/Animations/Walk.fbx
LFS
Normal file
BIN
godot/Assets/Animations/Walk.fbx
LFS
Normal file
Binary file not shown.
19823
godot/Assets/Models/Characters/Player.gltf
Normal file
19823
godot/Assets/Models/Characters/Player.gltf
Normal file
File diff suppressed because one or more lines are too long
BIN
godot/Assets/Textures/Black.png
LFS
Normal file
BIN
godot/Assets/Textures/Black.png
LFS
Normal file
Binary file not shown.
BIN
godot/Assets/Textures/Green.png
LFS
Normal file
BIN
godot/Assets/Textures/Green.png
LFS
Normal file
Binary file not shown.
BIN
godot/Assets/Textures/Orange.png
LFS
Normal file
BIN
godot/Assets/Textures/Orange.png
LFS
Normal file
Binary file not shown.
BIN
godot/Assets/Textures/Purple.png
LFS
Normal file
BIN
godot/Assets/Textures/Purple.png
LFS
Normal file
Binary file not shown.
BIN
godot/Assets/Textures/Red.png
LFS
Normal file
BIN
godot/Assets/Textures/Red.png
LFS
Normal file
Binary file not shown.
BIN
godot/Assets/Textures/Sky.png
LFS
Normal file
BIN
godot/Assets/Textures/Sky.png
LFS
Normal file
Binary file not shown.
BIN
godot/Assets/Textures/White.png
LFS
Normal file
BIN
godot/Assets/Textures/White.png
LFS
Normal file
Binary file not shown.
3776
godot/Scenes/Characters/player.tscn
Normal file
3776
godot/Scenes/Characters/player.tscn
Normal file
File diff suppressed because one or more lines are too long
92
godot/Scenes/Levels/prototype.tscn
Normal file
92
godot/Scenes/Levels/prototype.tscn
Normal file
@@ -0,0 +1,92 @@
|
||||
[gd_scene load_steps=18 format=3 uid="uid://coue2qehpn4fr"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b8q44ipg8a3cq" path="res://Assets/Textures/Black.png" id="1_hwes2"]
|
||||
[ext_resource type="Texture2D" uid="uid://doyodkg1ds7td" path="res://Assets/Textures/Sky.png" id="1_rrvcb"]
|
||||
[ext_resource type="Texture2D" uid="uid://gwt4mrbmdv01" path="res://Assets/Textures/Orange.png" id="2_087ax"]
|
||||
[ext_resource type="Texture2D" uid="uid://dkpqh8de7tb3n" path="res://Assets/Textures/Green.png" id="3_qkav0"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxmldotp7n010" path="res://Scenes/Characters/player.tscn" id="5_2382e"]
|
||||
|
||||
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_6c4vd"]
|
||||
panorama = ExtResource("1_rrvcb")
|
||||
|
||||
[sub_resource type="Sky" id="Sky_5ngqa"]
|
||||
sky_material = SubResource("PanoramaSkyMaterial_6c4vd")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_ctwiv"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_5ngqa")
|
||||
tonemap_mode = 2
|
||||
glow_enabled = true
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ajchh"]
|
||||
albedo_texture = ExtResource("1_hwes2")
|
||||
uv1_triplanar = true
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_mmup0"]
|
||||
material = SubResource("StandardMaterial3D_ajchh")
|
||||
size = Vector2(50, 50)
|
||||
|
||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_26ptr"]
|
||||
data = PackedVector3Array(25, 0, 25, -25, 0, 25, 25, 0, -25, -25, 0, 25, -25, 0, -25, 25, 0, -25)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jkvud"]
|
||||
albedo_texture = ExtResource("2_087ax")
|
||||
uv1_triplanar = true
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_plpqy"]
|
||||
material = SubResource("StandardMaterial3D_jkvud")
|
||||
size = Vector3(10, 3, 1)
|
||||
|
||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_v7prx"]
|
||||
data = PackedVector3Array(-5, 1.5, 0.5, 5, 1.5, 0.5, -5, -1.5, 0.5, 5, 1.5, 0.5, 5, -1.5, 0.5, -5, -1.5, 0.5, 5, 1.5, -0.5, -5, 1.5, -0.5, 5, -1.5, -0.5, -5, 1.5, -0.5, -5, -1.5, -0.5, 5, -1.5, -0.5, 5, 1.5, 0.5, 5, 1.5, -0.5, 5, -1.5, 0.5, 5, 1.5, -0.5, 5, -1.5, -0.5, 5, -1.5, 0.5, -5, 1.5, -0.5, -5, 1.5, 0.5, -5, -1.5, -0.5, -5, 1.5, 0.5, -5, -1.5, 0.5, -5, -1.5, -0.5, 5, 1.5, 0.5, -5, 1.5, 0.5, 5, 1.5, -0.5, -5, 1.5, 0.5, -5, 1.5, -0.5, 5, 1.5, -0.5, -5, -1.5, 0.5, 5, -1.5, 0.5, -5, -1.5, -0.5, 5, -1.5, 0.5, 5, -1.5, -0.5, -5, -1.5, -0.5)
|
||||
|
||||
[sub_resource type="PrismMesh" id="PrismMesh_0l7qq"]
|
||||
left_to_right = -2.0
|
||||
size = Vector3(5, 5, 5)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pfpgv"]
|
||||
albedo_texture = ExtResource("3_qkav0")
|
||||
uv1_triplanar = true
|
||||
|
||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_rit6o"]
|
||||
data = PackedVector3Array(-12.5, 2.5, 2.5, 2.5, -2.5, 2.5, -2.5, -2.5, 2.5, -12.5, 2.5, -2.5, -2.5, -2.5, -2.5, 2.5, -2.5, -2.5, -12.5, 2.5, 2.5, -12.5, 2.5, -2.5, 2.5, -2.5, 2.5, -12.5, 2.5, -2.5, 2.5, -2.5, -2.5, 2.5, -2.5, 2.5, -12.5, 2.5, -2.5, -12.5, 2.5, 2.5, -2.5, -2.5, -2.5, -12.5, 2.5, 2.5, -2.5, -2.5, 2.5, -2.5, -2.5, -2.5, -2.5, -2.5, 2.5, 2.5, -2.5, 2.5, -2.5, -2.5, -2.5, 2.5, -2.5, 2.5, 2.5, -2.5, -2.5, -2.5, -2.5, -2.5)
|
||||
|
||||
[node name="Prototype" type="Node3D"]
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_ctwiv")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-0.866026, -0.433013, 0.249999, 0.5, -0.75, 0.433012, -1.3411e-07, 0.499999, 0.866026, 0, 0, 0)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Floor" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("PlaneMesh_mmup0")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="Floor"]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor/StaticBody3D"]
|
||||
shape = SubResource("ConcavePolygonShape3D_26ptr")
|
||||
|
||||
[node name="Wall" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, -3)
|
||||
mesh = SubResource("BoxMesh_plpqy")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="Wall"]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Wall/StaticBody3D"]
|
||||
shape = SubResource("ConcavePolygonShape3D_v7prx")
|
||||
|
||||
[node name="Slope" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 1, 4)
|
||||
mesh = SubResource("PrismMesh_0l7qq")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_pfpgv")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="Slope"]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Slope/StaticBody3D"]
|
||||
shape = SubResource("ConcavePolygonShape3D_rit6o")
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("5_2382e")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0130468, 0)
|
||||
velocity = Vector3(0, 0, 0)
|
||||
63
godot/Scripts/Characters/Player.gd
Normal file
63
godot/Scripts/Characters/Player.gd
Normal file
@@ -0,0 +1,63 @@
|
||||
extends CharacterBody3D
|
||||
|
||||
const LERP_VALUE : float = 0.15
|
||||
|
||||
var snap_vector : Vector3 = Vector3.DOWN
|
||||
var speed : float
|
||||
|
||||
@export_group("Movement variables")
|
||||
@export var walk_speed : float = 2.0
|
||||
@export var run_speed : float = 5.0
|
||||
@export var jump_strength : float = 15.0
|
||||
@export var gravity : float = 50.0
|
||||
|
||||
const ANIMATION_BLEND : float = 7.0
|
||||
|
||||
@onready var player_mesh : Node3D = $Mesh
|
||||
@onready var spring_arm_pivot : Node3D = $SpringArmPivot
|
||||
@onready var animator : AnimationTree = $AnimationTree
|
||||
|
||||
func _physics_process(delta):
|
||||
var move_direction : Vector3 = Vector3.ZERO
|
||||
move_direction.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
|
||||
move_direction.z = Input.get_action_strength("move_backwards") - Input.get_action_strength("move_forwards")
|
||||
move_direction = move_direction.rotated(Vector3.UP, spring_arm_pivot.rotation.y)
|
||||
|
||||
velocity.y -= gravity * delta
|
||||
|
||||
if Input.is_action_pressed("run"):
|
||||
speed = run_speed
|
||||
else:
|
||||
speed = walk_speed
|
||||
|
||||
velocity.x = move_direction.x * speed
|
||||
velocity.z = move_direction.z * speed
|
||||
|
||||
if move_direction:
|
||||
player_mesh.rotation.y = lerp_angle(player_mesh.rotation.y, atan2(velocity.x, velocity.z), LERP_VALUE)
|
||||
|
||||
var just_landed := is_on_floor() and snap_vector == Vector3.ZERO
|
||||
var is_jumping := is_on_floor() and Input.is_action_just_pressed("jump")
|
||||
if is_jumping:
|
||||
velocity.y = jump_strength
|
||||
snap_vector = Vector3.ZERO
|
||||
elif just_landed:
|
||||
snap_vector = Vector3.DOWN
|
||||
|
||||
apply_floor_snap()
|
||||
move_and_slide()
|
||||
animate(delta)
|
||||
|
||||
func animate(delta):
|
||||
if is_on_floor():
|
||||
animator.set("parameters/ground_air_transition/transition_request", "grounded")
|
||||
|
||||
if velocity.length() > 0:
|
||||
if speed == run_speed:
|
||||
animator.set("parameters/iwr_blend/blend_amount", lerp(animator.get("parameters/iwr_blend/blend_amount"), 1.0, delta * ANIMATION_BLEND))
|
||||
else:
|
||||
animator.set("parameters/iwr_blend/blend_amount", lerp(animator.get("parameters/iwr_blend/blend_amount"), 0.0, delta * ANIMATION_BLEND))
|
||||
else:
|
||||
animator.set("parameters/iwr_blend/blend_amount", lerp(animator.get("parameters/iwr_blend/blend_amount"), -1.0, delta * ANIMATION_BLEND))
|
||||
else:
|
||||
animator.set("parameters/ground_air_transition/transition_request", "air")
|
||||
30
godot/Scripts/Characters/SpringArmPivot.gd
Normal file
30
godot/Scripts/Characters/SpringArmPivot.gd
Normal file
@@ -0,0 +1,30 @@
|
||||
extends Node3D
|
||||
|
||||
@export_group("FOV")
|
||||
@export var change_fov_on_run : bool
|
||||
@export var normal_fov : float = 75.0
|
||||
@export var run_fov : float = 90.0
|
||||
|
||||
const CAMERA_BLEND : float = 0.05
|
||||
|
||||
@onready var spring_arm : SpringArm3D = $SpringArm3D
|
||||
@onready var camera : Camera3D = $SpringArm3D/Camera3D
|
||||
|
||||
func _ready():
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseMotion:
|
||||
rotate_y(-event.relative.x * 0.005)
|
||||
spring_arm.rotate_x(-event.relative.y * 0.005)
|
||||
spring_arm.rotation.x = clamp(spring_arm.rotation.x, -PI/4, PI/4)
|
||||
|
||||
func _physics_process(_delta):
|
||||
if change_fov_on_run:
|
||||
if owner.is_on_floor():
|
||||
if Input.is_action_pressed("run"):
|
||||
camera.fov = lerp(camera.fov, run_fov, CAMERA_BLEND)
|
||||
else:
|
||||
camera.fov = lerp(camera.fov, normal_fov, CAMERA_BLEND)
|
||||
else:
|
||||
camera.fov = lerp(camera.fov, normal_fov, CAMERA_BLEND)
|
||||
@@ -1 +1 @@
|
||||
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z" fill="#478cbf"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>
|
||||
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 949 B After Width: | Height: | Size: 950 B |
@@ -1,10 +0,0 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://uiwigxsdnci1"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cuend5rtkhbnp" path="res://icon.svg" id="1_q81dj"]
|
||||
|
||||
[node name="Node2D" type="Node2D"]
|
||||
|
||||
[node name="GDExample" type="GDExample" parent="."]
|
||||
position = Vector2(5.20978, 6.34048)
|
||||
texture = ExtResource("1_q81dj")
|
||||
centered = false
|
||||
@@ -11,6 +11,40 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="Blitz3"
|
||||
run/main_scene="res://main.tscn"
|
||||
config/tags=PackedStringArray("templates")
|
||||
run/main_scene="res://Scenes/Levels/prototype.tscn"
|
||||
config/features=PackedStringArray("4.2", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[input]
|
||||
|
||||
move_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,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_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,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_forwards={
|
||||
"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,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_backwards={
|
||||
"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,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
run={
|
||||
"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":4194325,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
jump={
|
||||
"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":32,"key_label":0,"unicode":32,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user