Expose Player move_speed and set class_name

master
Fabien Freling 2019-02-16 17:41:32 +01:00
parent 3aeeaab1ba
commit b8c6084c19
4 changed files with 14 additions and 26 deletions

View File

@ -29,6 +29,7 @@ fov = 54.1445
[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 )
move_speed = 5.0
[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 )

View File

@ -8,9 +8,14 @@
config_version=4
_global_script_classes=[ ]
_global_script_classes=[ {
"base": "KinematicBody",
"class": "Player",
"language": "GDScript",
"path": "res://scenes/Player.gd"
} ]
_global_script_class_icons={
"Player": ""
}
[application]

View File

@ -1,4 +1,7 @@
extends KinematicBody
class_name Player
export var move_speed : float = 3.0
const norm_gravity = -100
var velocity = Vector3()
@ -28,8 +31,7 @@ func _physics_process(delta):
direction = direction.normalized()
# Speed
var speed = 3.0
direction *= speed
direction *= move_speed
# Gravity
direction.y = norm_gravity * delta

View File

@ -3,35 +3,15 @@
[ext_resource path="res://scenes/Player.gd" type="Script" id=1]
[ext_resource path="res://scenes/Hedgehog.tscn" type="PackedScene" id=2]
[sub_resource type="BoxShape" id=1]
extents = Vector3( 1, 1, 1 )
[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 )
[node name="CollisionShape" type="CollisionShape" parent="." index="0"]
[node name="CollisionShape" type="CollisionShape" parent="."]
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 )
_sections_unfolded = [ "Transform" ]