2.14 tweening hazards
This commit is contained in:
parent
4d8d71596c
commit
e7c63127dc
4 changed files with 109 additions and 1 deletions
20
scenes/MovingHazard.cs
Normal file
20
scenes/MovingHazard.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class MovingHazard : AnimatableBody3D
|
||||
{
|
||||
[Export]
|
||||
public Vector3 destination;
|
||||
[Export(PropertyHint.Range, "0.0, 10.0")]
|
||||
public float duration = 1.0f;
|
||||
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Tween tween = CreateTween();
|
||||
tween.SetLoops();
|
||||
tween.SetTrans(Tween.TransitionType.Sine);
|
||||
tween.TweenProperty(this, "global_position", GlobalPosition + destination, duration);
|
||||
tween.TweenProperty(this, "global_position", GlobalPosition - destination, duration);
|
||||
}
|
||||
}
|
|
@ -67,7 +67,7 @@ use_collision = true
|
|||
size = Vector3(2, 0.4, 2)
|
||||
material = SubResource("StandardMaterial3D_cjryw")
|
||||
script = ExtResource("1_2xhoj")
|
||||
nextLevel = "res://scenes/levels/level_1.tscn"
|
||||
nextLevel = "res://scenes/levels/level_4.tscn"
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.965926, 0.258819, 0, -0.258819, 0.965926, 0, 5, 10)
|
||||
|
|
69
scenes/levels/level_4.tscn
Normal file
69
scenes/levels/level_4.tscn
Normal file
|
@ -0,0 +1,69 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://b7ml4nkashg1j"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/levels/LandingPad.cs" id="1_750fa"]
|
||||
[ext_resource type="PackedScene" uid="uid://cuduv6fwqtocs" path="res://scenes/characters/player.tscn" id="2_lrcq2"]
|
||||
[ext_resource type="PackedScene" uid="uid://1dx7r681brmn" path="res://scenes/moving_hazard.tscn" id="3_upidg"]
|
||||
[ext_resource type="Script" path="res://scenes/MovingHazard.cs" id="4_j5l4t"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_51aor"]
|
||||
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_qesig"]
|
||||
sky_material = SubResource("ProceduralSkyMaterial_51aor")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_mlv3m"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_qesig")
|
||||
tonemap_mode = 2
|
||||
glow_enabled = true
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pdpk6"]
|
||||
albedo_color = Color(0.52, 0.203233, 0.078, 1)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5641g"]
|
||||
albedo_color = Color(0.269949, 0.472736, 0.828875, 1)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cjryw"]
|
||||
albedo_color = Color(0.270588, 0.662745, 0.321569, 1)
|
||||
|
||||
[node name="Level" type="Node3D"]
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_mlv3m")
|
||||
|
||||
[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="Floor" type="CSGBox3D" parent="." groups=["Hazard"]]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4, 0)
|
||||
use_collision = true
|
||||
size = Vector3(30, 8, 5)
|
||||
material = SubResource("StandardMaterial3D_pdpk6")
|
||||
|
||||
[node name="LaunchPad" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 0, 0)
|
||||
use_collision = true
|
||||
size = Vector3(2, 0.4, 2)
|
||||
material = SubResource("StandardMaterial3D_5641g")
|
||||
|
||||
[node name="LandingPad" type="CSGBox3D" parent="." groups=["Goal"]]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 0, 0)
|
||||
use_collision = true
|
||||
size = Vector3(2, 0.4, 2)
|
||||
material = SubResource("StandardMaterial3D_cjryw")
|
||||
script = ExtResource("1_750fa")
|
||||
nextLevel = "res://scenes/levels/level_1.tscn"
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.965926, 0.258819, 0, -0.258819, 0.965926, 0, 5, 10)
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("2_lrcq2")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 1.22214, 0)
|
||||
|
||||
[node name="MovingHazard" parent="." instance=ExtResource("3_upidg")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, 0)
|
||||
script = ExtResource("4_j5l4t")
|
||||
destination = Vector3(0, 2, 0)
|
||||
duration = 3.0
|
19
scenes/moving_hazard.tscn
Normal file
19
scenes/moving_hazard.tscn
Normal file
|
@ -0,0 +1,19 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://1dx7r681brmn"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_208vv"]
|
||||
albedo_color = Color(1, 0.486275, 1, 1)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_un3ti"]
|
||||
size = Vector3(3, 3, 3)
|
||||
|
||||
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_exqd3"]
|
||||
points = PackedVector3Array(-1.5, -1.49971, -1.49971, 1.5, 1.49978, 1.49978, 1.5, -1.49978, 1.49978, 1.5, 1.49978, -1.49978, -1.5, 1.49971, 1.49971, 1.5, -1.49978, -1.49978, -1.5, -1.49971, 1.49971, -1.5, 1.49971, -1.49971)
|
||||
|
||||
[node name="MovingHazard" type="AnimatableBody3D" groups=["Hazard"]]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
material_override = SubResource("StandardMaterial3D_208vv")
|
||||
mesh = SubResource("BoxMesh_un3ti")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("ConvexPolygonShape3D_exqd3")
|
Loading…
Add table
Reference in a new issue