From 7a55360a4ed3caea80e37b2b3fcca67c17fa4160 Mon Sep 17 00:00:00 2001 From: unfa Date: Sun, 14 Jun 2020 00:29:20 +0200 Subject: [PATCH 1/2] Changed gametree --- Game.tscn | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Game.tscn b/Game.tscn index 5a825e4..eedae57 100644 --- a/Game.tscn +++ b/Game.tscn @@ -1,4 +1,6 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://Player.gd" type="Script" id=1] [sub_resource type="BoxShape" id=1] @@ -37,6 +39,10 @@ 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 ) @@ -46,6 +52,3 @@ shape = SubResource( 3 ) 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="Camera" type="Camera" parent="."] -transform = Transform( 1, 0, 0, 0, 0.750734, 0.660605, 0, -0.660605, 0.750734, 0, 17.0162, 15.1792 ) From 47af6a05318336ca9734409c135b9491c0d7c57e Mon Sep 17 00:00:00 2001 From: unfa Date: Sun, 14 Jun 2020 00:29:58 +0200 Subject: [PATCH 2/2] Started work on Player movement --- Player.gd | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Player.gd diff --git a/Player.gd b/Player.gd new file mode 100644 index 0000000..67a73c5 --- /dev/null +++ b/Player.gd @@ -0,0 +1,30 @@ +extends KinematicBody + +const GRAVITY = 9.8 + +var velocity = Vector3.ZERO + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +func gravity(delta): + self.velocity.y -= GRAVITY * delta + +func motion(delta): + self.move_and_slide(velocity, Vector3.UP) + #rpc("move_and_slide", velocity, Vector3.UP) + +func _physics_process(delta): + gravity(delta) + motion(delta) + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass