2.4 controlling the player
This commit is contained in:
parent
680126711f
commit
ceffa3f159
2 changed files with 39 additions and 13 deletions
|
@ -2,20 +2,17 @@ using Godot;
|
|||
using System;
|
||||
|
||||
public partial class Player : Node3D
|
||||
{
|
||||
private int counter = 0;
|
||||
public override void _Ready()
|
||||
{
|
||||
GD.Print("Hello World!");
|
||||
GD.Print("Don't Panic!");
|
||||
}
|
||||
|
||||
{
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Input.IsActionJustPressed("ui_accept")){
|
||||
GD.Print("Spacebar is pressed");
|
||||
counter += 1;
|
||||
GD.Print("Counter: " + counter);
|
||||
if (Input.IsActionPressed("ui_accept")){
|
||||
Position += new Vector3(0, 1, 0) * (float)delta;
|
||||
}
|
||||
if (Input.IsActionPressed("ui_left")){
|
||||
RotateZ((float)delta);
|
||||
}
|
||||
if (Input.IsActionPressed("ui_right")){
|
||||
RotateZ(-(float)delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,35 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cuduv6fwqtocs"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cuduv6fwqtocs"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/characters/Player.cs" id="1_fr1bo"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_v656b"]
|
||||
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||
|
||||
[sub_resource type="Sky" id="Sky_ueadq"]
|
||||
sky_material = SubResource("ProceduralSkyMaterial_v656b")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_bdllf"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_ueadq")
|
||||
tonemap_mode = 2
|
||||
glow_enabled = true
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_dk8lw"]
|
||||
|
||||
[node name="Player" type="Node3D"]
|
||||
script = ExtResource("1_fr1bo")
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_bdllf")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-0.866025, -0.433013, 0.25, 0, 0.5, 0.866025, -0.5, 0.75, -0.433013, 0, 0, 0)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("CylinderMesh_dk8lw")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5)
|
||||
top_level = true
|
||||
|
|
Loading…
Add table
Reference in a new issue