add train

This commit is contained in:
2022-12-10 16:39:18 +01:00
parent 1afb543c56
commit e78c2e088c
6 changed files with 152 additions and 50 deletions

54
Nodes/Train_P1.tscn Normal file
View File

@@ -0,0 +1,54 @@
[gd_scene load_steps=8 format=3 uid="uid://lvlbpfnwlngv"]
[ext_resource type="Script" path="res://scripts/Train.gd" id="1_0x664"]
[ext_resource type="PackedScene" uid="uid://vwjd5od63jgh" path="res://Nodes/Player.tscn" id="3_in6up"]
[ext_resource type="PackedScene" uid="uid://c1mymb38wqdg6" path="res://Nodes/train.tscn" id="3_jmv6b"]
[sub_resource type="BoxShape3D" id="BoxShape3D_okaqh"]
size = Vector3(1, 3.77669, 24)
[sub_resource type="BoxShape3D" id="BoxShape3D_0svax"]
size = Vector3(12, 1, 24)
[sub_resource type="BoxShape3D" id="BoxShape3D_torlc"]
size = Vector3(12, 4, 1)
[sub_resource type="BoxShape3D" id="BoxShape3D_sm5ue"]
size = Vector3(1, 6, 9.05915)
[node name="Train1" type="Node3D"]
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, 0, 0, 0)
script = ExtResource("1_0x664")
[node name="train" parent="." instance=ExtResource("3_jmv6b")]
transform = Transform3D(-6.55671e-08, 0, 1.5, 0, 1.5, 0, -1.5, 0, -6.55671e-08, 3, 0, 9)
[node name="StaticBody3D" type="StaticBody3D" parent="train"]
transform = Transform3D(-2.91409e-08, 0, -0.666667, 0, 0.666667, 0, 0.666667, 0, -2.91409e-08, 6, -0.137826, -1.33333)
[node name="CollisionShape3D2" type="CollisionShape3D" parent="train/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.5, 2, 4.23516e-22)
shape = SubResource("BoxShape3D_okaqh")
[node name="CollisionShape3D3" type="CollisionShape3D" parent="train/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.5, 2, 3.55271e-15)
shape = SubResource("BoxShape3D_okaqh")
[node name="CollisionShape3D" type="CollisionShape3D" parent="train/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -3.55271e-15)
shape = SubResource("BoxShape3D_0svax")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="train/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 2, -12)
shape = SubResource("BoxShape3D_torlc")
[node name="CollisionShape3D5" type="CollisionShape3D" parent="train/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 2, 12)
shape = SubResource("BoxShape3D_torlc")
[node name="CollisionShape3D6" type="CollisionShape3D" parent="train/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 3, -1.52864)
shape = SubResource("BoxShape3D_sm5ue")
[node name="CharacterBody3D" parent="." instance=ExtResource("3_in6up")]
transform = Transform3D(1, 0, -3.55271e-15, 0, 1, 0, 3.55271e-15, 0, 1, 3.19744e-14, 3, -9)

54
Nodes/Train_P2.tscn Normal file
View File

@@ -0,0 +1,54 @@
[gd_scene load_steps=8 format=3 uid="uid://ckkn7rha3voqv"]
[ext_resource type="Script" path="res://scripts/Train.gd" id="1_mcmgl"]
[ext_resource type="PackedScene" uid="uid://c1mymb38wqdg6" path="res://Nodes/train.tscn" id="2_xoa1a"]
[ext_resource type="PackedScene" uid="uid://vwjd5od63jgh" path="res://Nodes/Player.tscn" id="3_x8j45"]
[sub_resource type="BoxShape3D" id="BoxShape3D_dijw3"]
size = Vector3(1, 3.77669, 24)
[sub_resource type="BoxShape3D" id="BoxShape3D_ao4pd"]
size = Vector3(12, 1, 24)
[sub_resource type="BoxShape3D" id="BoxShape3D_g76js"]
size = Vector3(12, 4, 1)
[sub_resource type="BoxShape3D" id="BoxShape3D_psmwd"]
size = Vector3(1, 6, 9.05915)
[node name="Train2" type="Node3D"]
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, 0, 0, 0)
script = ExtResource("1_mcmgl")
[node name="train" parent="." instance=ExtResource("2_xoa1a")]
transform = Transform3D(1.96701e-07, 0, -1.5, 0, 1.5, 0, 1.5, 0, 1.96701e-07, -3, 0, -9)
[node name="StaticBody3D2" type="StaticBody3D" parent="train"]
transform = Transform3D(-2.91409e-08, 0, -0.666667, 0, 0.666667, 0, 0.666667, 0, -2.91409e-08, 6, -0.137826, -1.33333)
[node name="CollisionShape3D2" type="CollisionShape3D" parent="train/StaticBody3D2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.5, 2, 4.23516e-22)
shape = SubResource("BoxShape3D_dijw3")
[node name="CollisionShape3D3" type="CollisionShape3D" parent="train/StaticBody3D2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.5, 2, 3.55271e-15)
shape = SubResource("BoxShape3D_dijw3")
[node name="CollisionShape3D" type="CollisionShape3D" parent="train/StaticBody3D2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -3.55271e-15)
shape = SubResource("BoxShape3D_ao4pd")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="train/StaticBody3D2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 2, -12)
shape = SubResource("BoxShape3D_g76js")
[node name="CollisionShape3D5" type="CollisionShape3D" parent="train/StaticBody3D2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 2, 12)
shape = SubResource("BoxShape3D_g76js")
[node name="CollisionShape3D6" type="CollisionShape3D" parent="train/StaticBody3D2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 3, -1.52864)
shape = SubResource("BoxShape3D_psmwd")
[node name="CharacterBody3D" parent="." instance=ExtResource("3_x8j45")]
transform = Transform3D(1, 0, -3.55271e-15, 0, 1, 0, 3.55271e-15, 0, 1, 2.84217e-14, 3, -8)

View File

@@ -1,9 +1,30 @@
[gd_scene load_steps=5 format=3 uid="uid://rtuidkgefekc"]
[gd_scene load_steps=9 format=3 uid="uid://db0pxwq1hvs45"]
[ext_resource type="Script" path="res://scripts/Logic/Game.gd" id="1_iox18"]
[ext_resource type="PackedScene" uid="uid://bqe8ucbruto1j" path="res://Nodes/StartNode.tscn" id="2_61aog"]
[ext_resource type="PackedScene" uid="uid://lvlbpfnwlngv" path="res://player.tscn" id="3_kknxo"]
[ext_resource type="PackedScene" uid="uid://lvlbpfnwlngv" path="res://Nodes/Train_P1.tscn" id="3_0be5n"]
[ext_resource type="PackedScene" uid="uid://cys06pnxfjl2m" path="res://Nodes/UI.tscn" id="4_kxuy0"]
[ext_resource type="PackedScene" uid="uid://ckkn7rha3voqv" path="res://Nodes/Train_P2.tscn" id="4_lmu0s"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_ghq3e"]
sky_top_color = Color(0.662745, 0.356863, 0.129412, 1)
sky_horizon_color = Color(0.815686, 0.145098, 0.254902, 1)
[sub_resource type="Sky" id="Sky_y00o5"]
sky_material = SubResource("ProceduralSkyMaterial_ghq3e")
process_mode = 1
[sub_resource type="Environment" id="Environment_t4j8q"]
background_mode = 2
background_energy_multiplier = 1.17
sky = SubResource("Sky_y00o5")
ambient_light_source = 3
tonemap_mode = 2
ssao_enabled = true
ssao_power = 9.0943
ssao_detail = 1.31
ssao_horizon = 0.21
ssil_enabled = true
[node name="Game" type="Node"]
script = ExtResource("1_iox18")
@@ -11,16 +32,22 @@ script = ExtResource("1_iox18")
[node name="StartNode" parent="." instance=ExtResource("2_61aog")]
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 20, 0)
transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 43, 26.0132)
current = true
fov = 30.0
size = 32.0
near = 0.041
[node name="Player1" parent="." instance=ExtResource("3_kknxo")]
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, -12, -1, 0)
[node name="Train1" parent="." instance=ExtResource("3_0be5n")]
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, -10, 0, 0)
[node name="Player2" parent="." instance=ExtResource("3_kknxo")]
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, 12, 0, 0)
[node name="Train2" parent="." instance=ExtResource("4_lmu0s")]
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, 10, 0, 0)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.258819, 0.965926, 0, -0.965926, 0.258819, 0, 0, 0)
transform = Transform3D(0.875944, -0.294781, 0.381872, -0.0210188, 0.767515, 0.640687, -0.481955, -0.569232, 0.666104, 0, 8.25958, 0)
[node name="Control" parent="." instance=ExtResource("4_kxuy0")]
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_t4j8q")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://tsku7fooj4g3"]
[gd_scene load_steps=10 format=3 uid="uid://c1mymb38wqdg6"]
[ext_resource type="PackedScene" uid="uid://by5dkvik2ti0a" path="res://Assets/Model/Train/TrainFloorTile4x4.glb" id="1_ruoy4"]
[ext_resource type="PackedScene" uid="uid://bbt38m8mno0d2" path="res://Assets/Model/Train/TrainWall.glb" id="2_ph0y0"]
@@ -89,10 +89,6 @@ transform = Transform3D(-4.56956e-08, 0, 1, 0, 1, 0, -1, 0, -4.56956e-08, 4, 0,
[node name="TrainPillarArcExtention6" parent="." instance=ExtResource("7_87n8g")]
transform = Transform3D(-4.17272e-08, 0, -1, 0, 1, 0, 1, 0, -4.17272e-08, 4, 0, -2)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.704748, -0.182867, -0.685485, 0.471599, 0.842588, 0.260075, 0.530022, -0.506562, 0.680053, 0, 9.83907, 0)
shadow_enabled = true
[node name="TrainPillarWood" parent="." instance=ExtResource("7_hd70v")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 2)

View File

@@ -1,31 +0,0 @@
[gd_scene load_steps=6 format=3 uid="uid://lvlbpfnwlngv"]
[ext_resource type="Script" path="res://scripts/Train.gd" id="1_0x664"]
[ext_resource type="PackedScene" uid="uid://byo1m0n20yl45" path="res://Nodes/cannon.tscn" id="2_71mfj"]
[ext_resource type="PackedScene" uid="uid://vwjd5od63jgh" path="res://Nodes/Player.tscn" id="3_in6up"]
[sub_resource type="BoxMesh" id="BoxMesh_ognqx"]
size = Vector3(13, 1, 25)
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_p3d4e"]
data = PackedVector3Array(-6.5, 0.5, 12.5, 6.5, 0.5, 12.5, -6.5, -0.5, 12.5, 6.5, 0.5, 12.5, 6.5, -0.5, 12.5, -6.5, -0.5, 12.5, 6.5, 0.5, -12.5, -6.5, 0.5, -12.5, 6.5, -0.5, -12.5, -6.5, 0.5, -12.5, -6.5, -0.5, -12.5, 6.5, -0.5, -12.5, 6.5, 0.5, 12.5, 6.5, 0.5, -12.5, 6.5, -0.5, 12.5, 6.5, 0.5, -12.5, 6.5, -0.5, -12.5, 6.5, -0.5, 12.5, -6.5, 0.5, -12.5, -6.5, 0.5, 12.5, -6.5, -0.5, -12.5, -6.5, 0.5, 12.5, -6.5, -0.5, 12.5, -6.5, -0.5, -12.5, 6.5, 0.5, 12.5, -6.5, 0.5, 12.5, 6.5, 0.5, -12.5, -6.5, 0.5, 12.5, -6.5, 0.5, -12.5, 6.5, 0.5, -12.5, -6.5, -0.5, 12.5, 6.5, -0.5, 12.5, -6.5, -0.5, -12.5, 6.5, -0.5, 12.5, 6.5, -0.5, -12.5, -6.5, -0.5, -12.5)
[node name="Player1" type="Node3D"]
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, -12, 0, 0)
script = ExtResource("1_0x664")
[node name="Cannon" parent="." instance=ExtResource("2_71mfj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.52346, 1.58651, -1.96232e-14)
[node name="MeshInstance3D2" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_ognqx")
[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D2"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D2/StaticBody3D"]
shape = SubResource("ConcavePolygonShape3D_p3d4e")
[node name="CharacterBody3D" parent="." instance=ExtResource("3_in6up")]
transform = Transform3D(1, 0, -3.55271e-15, 0, 1, 0, 3.55271e-15, 0, 1, 0, 3, 0)
[node name="Cannon2" parent="." instance=ExtResource("2_71mfj")]

View File

@@ -13,8 +13,8 @@ var fight_state = CHILL
var t = 0.0
@onready var p1_train = $Player1 as Train
@onready var p2_train = $Player2 as Train
@onready var p1_train = $Train1 as Train
@onready var p2_train = $Train2 as Train
@onready var StartNode = $StartNode
var p1_node : MapNode
@@ -22,8 +22,10 @@ var p2_node : MapNode
var initial_pos_p1 : Vector3
var initial_pos_p2 : Vector3
var initial_camera_pos: Vector3
func _ready():
initial_camera_pos = $Camera3D.position
initial_pos_p1 = p1_train.position
initial_pos_p2 = p2_train.position
p1_node = StartNode
@@ -68,9 +70,9 @@ func _process(delta):
var tween = create_tween()
tween.set_trans(Tween.TRANS_EXPO)
tween.set_ease(Tween.EASE_OUT)
var new_pos_p1 = p1_train.position + Vector3(-15,0,0)
var new_pos_p2 = p2_train.position + Vector3(15,0,0)
tween.tween_property($Camera3D, "position", Vector3(0,40,0), 1.4)
var new_pos_p1 = p1_train.position + Vector3(-30,0,-15)
var new_pos_p2 = p2_train.position + Vector3(30,0,-15)
tween.tween_property($Camera3D, "position", initial_camera_pos + Vector3(0,80,20), 1.4)
tween.set_parallel()
tween.tween_property(p1_train, "position",new_pos_p1, 1)
tween.tween_property(p2_train, "position",new_pos_p2, 1)
@@ -86,7 +88,7 @@ func _process(delta):
var tween = create_tween()
tween.set_trans(Tween.TRANS_EXPO)
tween.set_ease(Tween.EASE_OUT)
tween.tween_property($Camera3D, "position", Vector3(0,20,0), 1.4)
tween.tween_property($Camera3D, "position", initial_camera_pos, 1.4)
tween.set_parallel()
tween.tween_property(p1_train, "position",initial_pos_p1, 1)
tween.tween_property(p2_train, "position", initial_pos_p2, 1)