Separated the player into it's own scene. Removed player script print.

godot4-port
unfa 2020-06-14 00:50:54 +02:00
parent 96c8607987
commit 71b36b5a56
3 changed files with 27 additions and 22 deletions

View File

@ -1,16 +1,12 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Player.gd" type="Script" id=1]
[ext_resource path="res://Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://Game.gd" type="Script" id=2]
[sub_resource type="BoxShape" id=1]
[sub_resource type="CubeMesh" id=2]
[sub_resource type="CapsuleShape" id=3]
[sub_resource type="CapsuleMesh" id=4]
[node name="Game" type="Spatial"]
script = ExtResource( 2 )
@ -39,18 +35,4 @@ operation = 2
width = 12.0
depth = 12.0
[node name="Player" type="KinematicBody" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 12.2035, 0 )
script = ExtResource( 1 )
[node name="Camera" type="Camera" parent="Player"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.70316, -0.0651628 )
[node name="CollisionShape" type="CollisionShape" parent="Player"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0 )
shape = SubResource( 3 )
[node name="MeshInstance" type="MeshInstance" parent="Player"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = null
[node name="Player" parent="." instance=ExtResource( 1 )]

View File

@ -25,7 +25,7 @@ func walk():
if Input.is_action_pressed("MoveLeft"):
walkDirection.y -= 1
print("Player walkDirection: ", walkDirection)
#print("Player walkDirection: ", walkDirection)
func motion(delta):
self.move_and_slide(velocity * delta, Vector3.UP)

23
Player.tscn Normal file
View File

@ -0,0 +1,23 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Player.gd" type="Script" id=1]
[sub_resource type="CapsuleShape" id=3]
[sub_resource type="CapsuleMesh" id=4]
[node name="Player" type="KinematicBody"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 12.2035, 0 )
script = ExtResource( 1 )
[node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.70316, -0.0651628 )
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0 )
shape = SubResource( 3 )
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = null