mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 12:16:14 +01:00
Initial Game Logic
This commit is contained in:
53
Nodes/game.tscn
Normal file
53
Nodes/game.tscn
Normal file
@@ -0,0 +1,53 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://n7w0ff7u25yc"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Logic/Game.gd" id="1_iox18"]
|
||||
|
||||
[sub_resource type="Curve3D" id="Curve3D_42kdk"]
|
||||
_data = {
|
||||
"points": PackedVector3Array(-8, 0, 0, 8, 0, 0, 0, 0, -8, -16, 0, 0, 16, 0, 0, 72, 0, -16, 0, 0, -16, 0, 0, 16, 88, 0, 0, 16, 0, 0, -16, 0, 0, 72, 0, 16, 0, 0, 16, 0, 0, -16, 56, 0, 0, -16, 0, 0, 16, 0, 0, 72, 0, -16, 0, 0, -16, 0, 0, 16, 88, 0, 0, 16, 0, 0, -16, 0, 0, 72, 0, 16, 8, 0, 0, -8, 0, 0, 0, 0, 8, 0, 0, 8, 0, 0, -8, -8, 0, 0, -8, 0, 0, 8, 0, 0, 0, 0, -8, 0, 0, -8, 0, 0, 8, 8, 0, 0, 8, 0, 0, -8, 0, 0, 0, 0, 8, 0, 0, 8, 0, 0, -8, -8, 0, 0, -8, 0, 0, 8, 0, 0, 0, 0, -8),
|
||||
"tilts": PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
}
|
||||
point_count = 15
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_3vwcb"]
|
||||
size = Vector3(1, 1, 2)
|
||||
|
||||
[sub_resource type="Curve3D" id="Curve3D_ycdkn"]
|
||||
_data = {
|
||||
"points": PackedVector3Array(-16, 0, 0, 16, 0, 0, 0, 0, -16, 0, 0, -16, 0, 0, 16, 16, 0, 0, 16, 0, 0, -16, 0, 0, 0, 0, 16, 0, 0, 16, 0, 0, -16, -15.9109, 0.0032196, 0.0159729, -16, 0, 0, 16, 0, 0, 0, 0, -16, -8, 0, 0, 8, 0, 0, 72, 0, -8, 0, 0, -8, 0, 0, 8, 80, 0, 0, 8, 0, 0, -8, 0, 0, 72, 0, 8, 0, 0, 8, 0, 0, -8, 64, 0, 0, -8, 0, 0, 8, 0, 0, 72, 0, -8, 0, 0, -8, 0, 0, 8, 80, 0, 0, 8, 0, 0, -8, 0, 0, 72, 0, 8, 16, 0, 0, -16, 0, 0, 0, 0, 16, 0, 0, 16, 0, 0, -16, -16, 0, 0, -16, 0, 0, 16, 0, 0, 0, 0, -16),
|
||||
"tilts": PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
}
|
||||
point_count = 15
|
||||
|
||||
[node name="Game" type="Node"]
|
||||
script = ExtResource("1_iox18")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 1.77636e-14, 7.76471e-22, 0, -4.37114e-08, 1, 1.77636e-14, -1, -4.37114e-08, 36.5305, 43.522, 0.295507)
|
||||
|
||||
[node name="Player1Path" type="Path3D" parent="."]
|
||||
curve = SubResource("Curve3D_42kdk")
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="Player1Path"]
|
||||
transform = Transform3D(-4.37107e-08, 0, 0.999984, 0, 1, 0, -0.999984, 0, -4.37107e-08, 0, 0, -8)
|
||||
|
||||
[node name="root" type="Node3D" parent="Player1Path/PathFollow3D"]
|
||||
|
||||
[node name="Zug1" type="MeshInstance3D" parent="Player1Path/PathFollow3D/root"]
|
||||
transform = Transform3D(1, 0, -7.10543e-15, 0, 1, 0, 7.10543e-15, 0, 1, 0, 0, 0)
|
||||
mesh = SubResource("BoxMesh_3vwcb")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="Player2Path" type="Path3D" parent="."]
|
||||
curve = SubResource("Curve3D_ycdkn")
|
||||
|
||||
[node name="PathFollow3D" type="PathFollow3D" parent="Player2Path"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -16)
|
||||
|
||||
[node name="root" type="Node3D" parent="Player2Path/PathFollow3D"]
|
||||
transform = Transform3D(-0.0154456, -6.75146e-10, -0.999881, -5.21344e-12, 1, -6.75146e-10, 0.999881, -5.21341e-12, -0.0154456, 0, 0, 0)
|
||||
|
||||
[node name="Zug1" type="MeshInstance3D" parent="Player2Path/PathFollow3D/root"]
|
||||
transform = Transform3D(1, 0, -7.10543e-15, 0, 1, 0, 7.10543e-15, 0, 1, 0, 0, 0)
|
||||
mesh = SubResource("BoxMesh_3vwcb")
|
||||
skeleton = NodePath("../..")
|
||||
27
scripts/Logic/Game.gd
Normal file
27
scripts/Logic/Game.gd
Normal file
@@ -0,0 +1,27 @@
|
||||
extends Node
|
||||
|
||||
#Signals
|
||||
signal ammo_pickup
|
||||
signal shoot
|
||||
|
||||
var t = 0.0
|
||||
@onready var tween = create_tween() as Tween
|
||||
@onready var p1 = $Player1Path/PathFollow3D
|
||||
@onready var p2 = $Player2Path/PathFollow3D
|
||||
|
||||
|
||||
func _ready():
|
||||
start_tween()
|
||||
|
||||
func start_tween():
|
||||
tween.set_trans(Tween.TRANS_LINEAR)
|
||||
tween.set_parallel(true)
|
||||
tween.tween_property(p1, "progress_ratio", 1, 5)
|
||||
tween.tween_property(p2, "progress_ratio", -1, 5)
|
||||
|
||||
func _process(delta):
|
||||
if round(p1.position.distance_to(p2.position)) == 9:
|
||||
emit_signal("shoot")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user