Expose Player move_speed and set class_name
This commit is contained in:
parent
3aeeaab1ba
commit
b8c6084c19
|
@ -29,6 +29,7 @@ fov = 54.1445
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource( 4 )]
|
[node name="Player" parent="." instance=ExtResource( 4 )]
|
||||||
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, -2.88637, 2.79728, -2.72332 )
|
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, -2.88637, 2.79728, -2.72332 )
|
||||||
|
move_speed = 5.0
|
||||||
|
|
||||||
[node name="Goal" parent="." instance=ExtResource( 5 )]
|
[node name="Goal" parent="." instance=ExtResource( 5 )]
|
||||||
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0.993621, 1.99794, 1.00068 )
|
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0.993621, 1.99794, 1.00068 )
|
||||||
|
|
|
@ -8,9 +8,14 @@
|
||||||
|
|
||||||
config_version=4
|
config_version=4
|
||||||
|
|
||||||
_global_script_classes=[ ]
|
_global_script_classes=[ {
|
||||||
|
"base": "KinematicBody",
|
||||||
|
"class": "Player",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://scenes/Player.gd"
|
||||||
|
} ]
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
|
"Player": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
extends KinematicBody
|
extends KinematicBody
|
||||||
|
class_name Player
|
||||||
|
|
||||||
|
export var move_speed : float = 3.0
|
||||||
|
|
||||||
const norm_gravity = -100
|
const norm_gravity = -100
|
||||||
var velocity = Vector3()
|
var velocity = Vector3()
|
||||||
|
@ -28,8 +31,7 @@ func _physics_process(delta):
|
||||||
direction = direction.normalized()
|
direction = direction.normalized()
|
||||||
|
|
||||||
# Speed
|
# Speed
|
||||||
var speed = 3.0
|
direction *= move_speed
|
||||||
direction *= speed
|
|
||||||
|
|
||||||
# Gravity
|
# Gravity
|
||||||
direction.y = norm_gravity * delta
|
direction.y = norm_gravity * delta
|
||||||
|
|
|
@ -3,35 +3,15 @@
|
||||||
[ext_resource path="res://scenes/Player.gd" type="Script" id=1]
|
[ext_resource path="res://scenes/Player.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://scenes/Hedgehog.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://scenes/Hedgehog.tscn" type="PackedScene" id=2]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[sub_resource type="BoxShape" id=1]
|
[sub_resource type="BoxShape" id=1]
|
||||||
|
|
||||||
extents = Vector3( 1, 1, 1 )
|
|
||||||
|
|
||||||
[node name="Player" type="KinematicBody"]
|
[node name="Player" type="KinematicBody"]
|
||||||
|
|
||||||
input_ray_pickable = true
|
|
||||||
input_capture_on_drag = false
|
|
||||||
collision_layer = 1
|
|
||||||
collision_mask = 1
|
|
||||||
axis_lock_linear_x = false
|
|
||||||
axis_lock_linear_y = false
|
|
||||||
axis_lock_linear_z = false
|
|
||||||
axis_lock_angular_x = false
|
|
||||||
axis_lock_angular_y = false
|
|
||||||
axis_lock_angular_z = false
|
|
||||||
collision/safe_margin = 0.001
|
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="CollisionShape" type="CollisionShape" parent="." index="0"]
|
[node name="CollisionShape" type="CollisionShape" parent="."]
|
||||||
|
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
disabled = false
|
|
||||||
|
|
||||||
[node name="Hedgehog" parent="." index="1" instance=ExtResource( 2 )]
|
|
||||||
|
|
||||||
|
[node name="Hedgehog" parent="." instance=ExtResource( 2 )]
|
||||||
transform = Transform( 0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0 )
|
transform = Transform( 0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0 )
|
||||||
_sections_unfolded = [ "Transform" ]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue