Added a new scene
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dchj6g2i8ebph"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpxggc8nr6tf6" path="res://scenes/player.gd" id="2_w7c3h"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_2q6dc"]
|
||||
bounce = 0.5
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_2q6dc"]
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_w7c3h"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_w8frs"]
|
||||
bounce = 0.5
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_mx8sn"]
|
||||
|
||||
[node name="Node3D" type="Node3D"]
|
||||
|
||||
[node name="Thing" type="RigidBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -3.7986288)
|
||||
physics_material_override = SubResource("PhysicsMaterial_2q6dc")
|
||||
gravity_scale = 0.0
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 5
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Thing"]
|
||||
shape = SubResource("SphereShape3D_2q6dc")
|
||||
debug_color = Color(0.29772994, 0.6216631, 0.28140613, 0.41960785)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Thing"]
|
||||
mesh = SubResource("SphereMesh_w7c3h")
|
||||
|
||||
[node name="Player" type="RigidBody3D" parent="."]
|
||||
physics_material_override = SubResource("PhysicsMaterial_w8frs")
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource("2_w7c3h")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Player"]
|
||||
shape = SubResource("SphereShape3D_mx8sn")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="Player"]
|
||||
@@ -0,0 +1,16 @@
|
||||
extends RigidBody3D
|
||||
|
||||
# Initially I used a CharacterBody3D, however, I wanted the player to bounce off
|
||||
# other objects in the environment and that would have required manual handling
|
||||
# of collisions. So that's why we're using a RigidBody3D instead.
|
||||
|
||||
const ACCELLERATION = 5.0
|
||||
|
||||
func _integrate_forces(state):
|
||||
var input_dir = Vector3.ZERO
|
||||
input_dir.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
|
||||
input_dir.z = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
|
||||
input_dir = input_dir.normalized()
|
||||
|
||||
linear_velocity.x += input_dir.x * (ACCELLERATION * state.step)
|
||||
linear_velocity.z += input_dir.z * (ACCELLERATION * state.step)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bpxggc8nr6tf6
|
||||
@@ -2,8 +2,7 @@ extends Control
|
||||
|
||||
|
||||
func _on_start_button_pressed():
|
||||
pass # TODO: update below with the game scene
|
||||
# get_tree().change_scene_to_file("TODO")
|
||||
get_tree().change_scene_to_file("res://scenes/level.tscn")
|
||||
|
||||
func _on_settings_button_pressed():
|
||||
get_tree().change_scene_to_file("res://scenes/Settings.tscn")
|
||||
|
||||
Reference in New Issue
Block a user