mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 04:16:12 +01:00
infinite scroll
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=10 format=3 uid="uid://cqkd0g15r5btu"]
|
[gd_scene load_steps=11 format=3 uid="uid://cqkd0g15r5btu"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/Logic/Game.gd" id="1_gf730"]
|
[ext_resource type="Script" path="res://scripts/Logic/Game.gd" id="1_gf730"]
|
||||||
[ext_resource type="PackedScene" path="res://Nodes/light_setup.tscn" id="2_8im8o"]
|
[ext_resource type="PackedScene" uid="uid://nxapkgcq2c70" path="res://Nodes/light_setup.tscn" id="2_8im8o"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bqe8ucbruto1j" path="res://Nodes/StartNode.tscn" id="3_s558u"]
|
[ext_resource type="PackedScene" uid="uid://bqe8ucbruto1j" path="res://Nodes/StartNode.tscn" id="3_s558u"]
|
||||||
[ext_resource type="PackedScene" uid="uid://md2ofbviios3" path="res://Nodes/Train_P1.tscn" id="4_05mbx"]
|
[ext_resource type="PackedScene" uid="uid://md2ofbviios3" path="res://Nodes/Train_P1.tscn" id="4_05mbx"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bikdn7ep2vpxw" path="res://Nodes/Train_P2.tscn" id="5_gee2r"]
|
[ext_resource type="PackedScene" uid="uid://bikdn7ep2vpxw" path="res://Nodes/Train_P2.tscn" id="5_gee2r"]
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
[ext_resource type="AudioStream" uid="uid://c5jhukuk8r3mf" path="res://Assets/Sounds/_MUSIC_/GameJamGameLoop.wav" id="7_0xbd4"]
|
[ext_resource type="AudioStream" uid="uid://c5jhukuk8r3mf" path="res://Assets/Sounds/_MUSIC_/GameJamGameLoop.wav" id="7_0xbd4"]
|
||||||
[ext_resource type="AudioStream" uid="uid://n4ynf7hg2pcl" path="res://Assets/Sounds/_SOUNDFX_/GleiseLoop.wav" id="8_1d2gk"]
|
[ext_resource type="AudioStream" uid="uid://n4ynf7hg2pcl" path="res://Assets/Sounds/_SOUNDFX_/GleiseLoop.wav" id="8_1d2gk"]
|
||||||
[ext_resource type="AudioStream" uid="uid://dovvnflvxtqpi" path="res://Assets/Sounds/_SOUNDFX_/WindLoop.wav" id="9_8qwj6"]
|
[ext_resource type="AudioStream" uid="uid://dovvnflvxtqpi" path="res://Assets/Sounds/_SOUNDFX_/WindLoop.wav" id="9_8qwj6"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bw3yluhr72n2t" path="res://Nodes/InfiniteScroller.tscn" id="10_rs3tc"]
|
||||||
|
|
||||||
[node name="Game" type="Node"]
|
[node name="Game" type="Node"]
|
||||||
script = ExtResource("1_gf730")
|
script = ExtResource("1_gf730")
|
||||||
@@ -25,10 +26,16 @@ size = 32.0
|
|||||||
near = 0.041
|
near = 0.041
|
||||||
|
|
||||||
[node name="Train1" parent="." instance=ExtResource("4_05mbx")]
|
[node name="Train1" parent="." instance=ExtResource("4_05mbx")]
|
||||||
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, -10, 0, 0)
|
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, -12, 0, 0)
|
||||||
|
|
||||||
|
[node name="InfiniteScroller" parent="Train1" instance=ExtResource("10_rs3tc")]
|
||||||
|
transform = Transform3D(1, 0, -3.55271e-15, 0, 1, 0, 3.55271e-15, 0, 1, 0, -1, -96)
|
||||||
|
|
||||||
[node name="Train2" parent="." instance=ExtResource("5_gee2r")]
|
[node name="Train2" parent="." instance=ExtResource("5_gee2r")]
|
||||||
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, 9.90113, -0.0549407, -0.085681)
|
transform = Transform3D(1, 0, 3.55271e-15, 0, 1, 0, -3.55271e-15, 0, 1, 11.9011, -0.0549407, -0.085681)
|
||||||
|
|
||||||
|
[node name="InfiniteScroller2" parent="Train2" instance=ExtResource("10_rs3tc")]
|
||||||
|
transform = Transform3D(1, 0, -3.55271e-15, 0, 1, 0, 3.55271e-15, 0, 1, 0, -2, -104)
|
||||||
|
|
||||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
transform = Transform3D(0.875944, -0.294781, 0.381872, -0.106805, 0.65344, 0.749406, -0.470441, -0.697224, 0.540892, 0, 8.25958, 0)
|
transform = Transform3D(0.875944, -0.294781, 0.381872, -0.106805, 0.65344, 0.749406, -0.470441, -0.697224, 0.540892, 0, 8.25958, 0)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func _ready():
|
|||||||
p2_train.is_P1 = false
|
p2_train.is_P1 = false
|
||||||
p1_train.hit.connect(_on_hit_player)
|
p1_train.hit.connect(_on_hit_player)
|
||||||
p2_train.hit.connect(_on_hit_player)
|
p2_train.hit.connect(_on_hit_player)
|
||||||
p1_train.current_speed = 6
|
p1_train.current_speed = 20
|
||||||
p2_train.current_speed = 6
|
p2_train.current_speed = 6
|
||||||
|
|
||||||
func getMapSize(node, is_start):
|
func getMapSize(node, is_start):
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
extends Node3D
|
extends Node3D
|
||||||
|
|
||||||
@onready var rails = preload("res://Assets/Model/Objects/rail_tracks.glb")
|
@onready var rails = preload("res://Nodes/rail_tracks.tscn")
|
||||||
|
@onready var container = $Container
|
||||||
# Called when the node enters the scene tree for the first time
|
# Called when the node enters the scene tree for the first time
|
||||||
var offset = 0
|
var offset = -13
|
||||||
|
var last_obj
|
||||||
func _ready():
|
func _ready():
|
||||||
|
var obj = rails.instantiate() as Node3D
|
||||||
|
#obj.position = position
|
||||||
|
add_child(obj)
|
||||||
|
obj.position = Vector3.ZERO
|
||||||
|
last_obj = obj
|
||||||
|
|
||||||
var timer = Timer.new()
|
var timer = Timer.new()
|
||||||
self.add_child(timer)
|
self.add_child(timer)
|
||||||
timer.timeout.connect(create_rail)
|
timer.timeout.connect(create_rail)
|
||||||
@@ -12,17 +20,7 @@ func _ready():
|
|||||||
|
|
||||||
func create_rail():
|
func create_rail():
|
||||||
var obj = rails.instantiate()
|
var obj = rails.instantiate()
|
||||||
obj.rotation.y = deg_to_rad(90)
|
#obj.position = position
|
||||||
obj.position = Vector3(0,0,13)
|
obj.position.z = last_obj.position.z + offset
|
||||||
offset -= 13
|
|
||||||
add_child(obj)
|
add_child(obj)
|
||||||
|
last_obj = obj
|
||||||
var timer = Timer.new()
|
|
||||||
obj.add_child(timer)
|
|
||||||
# Connect the timer to make it call "queue_free" after two seconds
|
|
||||||
timer.timeout.connect(obj.queue_free)
|
|
||||||
timer.set_wait_time(2)
|
|
||||||
timer.start()
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
position.z += delta * 40
|
|
||||||
|
|||||||
Reference in New Issue
Block a user