Added robot and basic movement - NOTE robot is not spawning! Placeholder
This commit is contained in:
parent
2b66f20365
commit
7d11dff160
6 changed files with 112 additions and 15 deletions
33
scenes/robot.gd
Normal file
33
scenes/robot.gd
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
var robot_delay = randf_range(3.5,7)
|
||||
var robot_ready: bool = false
|
||||
var robot_win: bool = false
|
||||
var speed: int = 3.5
|
||||
|
||||
@onready var safety_zone = get_node("/root/Game/World/ElevatorDoors/ElevatorSafeZone")
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
await get_tree().create_timer(robot_delay).timeout
|
||||
robot_ready = true
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
if robot_win == true: return
|
||||
if robot_ready == false: return
|
||||
|
||||
if robot_ready == true:
|
||||
velocity.z -= speed * delta
|
||||
move_and_slide()
|
||||
|
||||
if robot_win == true: return
|
||||
|
||||
|
||||
|
||||
func _on_area_3d_area_entered(area: Area3D) -> void:
|
||||
var safety = safety_zone
|
||||
if area == safety: #TODO: if entered safety AND door is open, then GAME OVER!
|
||||
robot_win = true
|
||||
print("got you!")
|
||||
|
||||
1
scenes/robot.gd.uid
Normal file
1
scenes/robot.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c0ii52yy7qbcu
|
||||
30
scenes/robot.tscn
Normal file
30
scenes/robot.tscn
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
[gd_scene format=3 uid="uid://b8q1mk8ub3dwm"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ba2ywy388r8g1" path="res://images/bot.png" id="1_br0rw"]
|
||||
[ext_resource type="Script" uid="uid://c0ii52yy7qbcu" path="res://scenes/robot.gd" id="1_ykvnc"]
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_ykvnc"]
|
||||
height = 1.8903809
|
||||
|
||||
[node name="Robot" type="CharacterBody3D" unique_id=985954885]
|
||||
transform = Transform3D(3.5, 0, 0, 0, 3.5, 0, 0, 0, 3.5, 0, 0, 0)
|
||||
script = ExtResource("1_ykvnc")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="." unique_id=606423155]
|
||||
billboard = 1
|
||||
texture_filter = 0
|
||||
texture = ExtResource("1_br0rw")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=94553291]
|
||||
transform = Transform3D(1.25, 0, 0, 0, 1.25, 0, 0, 0, 1.25, 0, 0.29987764, 0)
|
||||
shape = SubResource("CylinderShape3D_ykvnc")
|
||||
disabled = true
|
||||
|
||||
[node name="Area3D" type="Area3D" parent="." unique_id=1853898157]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D" unique_id=273523738]
|
||||
transform = Transform3D(1.25, 0, 0, 0, 1.25, 0, 0, 0, 1.25, 0, 0.29987764, 0)
|
||||
shape = SubResource("CylinderShape3D_ykvnc")
|
||||
disabled = true
|
||||
|
||||
[connection signal="area_entered" from="Area3D" to="." method="_on_area_3d_area_entered"]
|
||||
|
|
@ -2,12 +2,9 @@
|
|||
|
||||
[ext_resource type="PackedScene" uid="uid://dowvqakiqkvk5" path="res://scenes/camera_3d.tscn" id="1_f3sb7"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxnocjdotkl5e" path="res://scenes/hall_block.tscn" id="1_tlwt5"]
|
||||
[ext_resource type="PackedScene" uid="uid://b8q1mk8ub3dwm" path="res://scenes/robot.tscn" id="3_71j4m"]
|
||||
[ext_resource type="PackedScene" uid="uid://8ybwrid1vk4j" path="res://scenes/elevator_door.tscn" id="3_k0juu"]
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_tlwt5"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_aqk2v"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_k0juu"]
|
||||
size = Vector3(9.291687, 1, 1.9597168)
|
||||
|
||||
|
|
@ -32,17 +29,8 @@ transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0, 0
|
|||
[node name="HallBlock0" parent="Hall" unique_id=1901572100 instance=ExtResource("1_tlwt5")]
|
||||
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0, 0, -5.4)
|
||||
|
||||
[node name="Enemy Placeholder" type="StaticBody3D" parent="." unique_id=133407620]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.6470537, 0, 4.4912777)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Enemy Placeholder" unique_id=996721213]
|
||||
transform = Transform3D(2.75, 0, 0, 0, 2.75, 0, 0, 0, 2.75, -2.6999998, 2.9387112, 3.8988447)
|
||||
mesh = SubResource("CapsuleMesh_tlwt5")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Enemy Placeholder" unique_id=1517735028]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.7, 1.048, 3.899)
|
||||
shape = SubResource("CapsuleShape3D_aqk2v")
|
||||
disabled = true
|
||||
[node name="Robot" parent="." unique_id=985954885 instance=ExtResource("3_71j4m")]
|
||||
transform = Transform3D(3.5, 0, 0, 0, 3.5, 0, 0, 0, 3.5, 0, 2.5, 11.970772)
|
||||
|
||||
[node name="ElevatorDoors" type="Node3D" parent="." unique_id=351419432]
|
||||
|
||||
|
|
@ -63,3 +51,8 @@ transform = Transform3D(-4, 0, 3.496911e-07, 0, 4, 0, -3.496911e-07, 0, -4, -4.4
|
|||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.9181392, 13.711893)
|
||||
gizmo_extents = 1.46
|
||||
|
||||
[node name="RobotSpawn" type="Marker3D" parent="." unique_id=1467272276]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, 16.264744)
|
||||
gizmo_extents = 1.46
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue