Expose Player move_speed and set class_name
This commit is contained in:
parent
3aeeaab1ba
commit
b8c6084c19
4 changed files with 14 additions and 26 deletions
|
@ -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
|
||||
|
|
|
@ -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" ]
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue