Erster Prototyp

This commit is contained in:
Exobyt 2024-08-17 19:46:21 +02:00
parent 2da5af8954
commit 885351b624
48 changed files with 1350 additions and 0 deletions

View file

@ -0,0 +1,33 @@
[gd_scene load_steps=5 format=3 uid="uid://c03h0nwewolfx"]
[ext_resource type="Texture2D" uid="uid://dbspjkdc5q1mc" path="res://assets/Slider.png" id="1_idpo1"]
[ext_resource type="Texture2D" uid="uid://blj4h34gr3s0q" path="res://assets/SpeedScale.png" id="1_otl7y"]
[ext_resource type="Script" path="res://scenes/Grid/speed_scale.gd" id="1_w2ui3"]
[sub_resource type="Curve2D" id="Curve2D_jnpcs"]
_data = {
"points": PackedVector2Array(0, 0, 0, 0, 0, 628, 0, 0, 0, 0, 0, -636)
}
point_count = 2
[node name="SpeedScale" type="Node2D"]
script = ExtResource("1_w2ui3")
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(12.8, 12.8)
texture = ExtResource("1_otl7y")
[node name="Path2D" type="Path2D" parent="."]
position = Vector2(0, 3.94867)
scale = Vector2(1, 0.99359)
curve = SubResource("Curve2D_jnpcs")
[node name="Slider" type="PathFollow2D" parent="Path2D"]
position = Vector2(0, -636)
progress = 1264.0
rotates = false
loop = false
[node name="Sprite2D" type="Sprite2D" parent="Path2D/Slider"]
scale = Vector2(12.8, 12.8)
texture = ExtResource("1_idpo1")

7
scenes/Grid/border.tscn Normal file
View file

@ -0,0 +1,7 @@
[gd_scene format=3 uid="uid://bm7rshwf6pjb"]
[node name="Border" type="Area2D"]
collision_layer = 9
collision_mask = 21
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]

5
scenes/Grid/bottom.tscn Normal file
View file

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=3 uid="uid://dvrotjxom4u6d"]
[ext_resource type="PackedScene" uid="uid://bm7rshwf6pjb" path="res://scenes/Grid/border.tscn" id="1_djp4e"]
[node name="Bottom" instance=ExtResource("1_djp4e")]

37
scenes/Grid/grid.gd Normal file
View file

@ -0,0 +1,37 @@
extends Node2D
@onready var spawnpoint = $Spawnpoint
var nextBlocks = []
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
fillNextBlocks()
spawnBlock()
func spawnBlock() -> void:
var block = nextBlocks[0]
GLOBAL.currentBlock = block
spawnpoint.add_child(block)
nextBlocks.pop_at(0)
if nextBlocks.size() < 2:
fillNextBlocks()
func _physics_process(delta: float) -> void:
if GLOBAL.currentBlock != null:
if GLOBAL.currentBlock.stopped:
spawnBlock()
func fillNextBlocks():
var newBlocks = []
for i in GLOBAL.BLOCKS:
var block = load(GLOBAL.BLOCKS[i]).instantiate()
block.setId(GLOBAL.getNewId())
block.setType(GLOBAL.BLOCKTYPES.LIGHT)
newBlocks.append(block)
newBlocks.shuffle()
newBlocks[0].setType(GLOBAL.BLOCKTYPES.HEAVY)
newBlocks.shuffle()
nextBlocks.append_array(newBlocks)

118
scenes/Grid/grid.tscn Normal file
View file

@ -0,0 +1,118 @@
[gd_scene load_steps=8 format=3 uid="uid://dwl4lotl1d3ij"]
[ext_resource type="Script" path="res://scenes/Grid/grid.gd" id="1_vie5m"]
[ext_resource type="PackedScene" uid="uid://bm7rshwf6pjb" path="res://scenes/Grid/border.tscn" id="4_3j08q"]
[ext_resource type="PackedScene" uid="uid://duubii5uu3lgq" path="res://scenes/Grid/row_test.tscn" id="4_si3v6"]
[ext_resource type="PackedScene" uid="uid://dvrotjxom4u6d" path="res://scenes/Grid/bottom.tscn" id="5_14njh"]
[sub_resource type="QuadMesh" id="QuadMesh_qfjsc"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_flipi"]
size = Vector2(128, 1536)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rxd0s"]
size = Vector2(896, 64)
[node name="Grid" type="Node2D"]
script = ExtResource("1_vie5m")
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(7.62939e-06, 7.62939e-06)
scale = Vector2(108.422, 96.375)
[node name="MeshInstance2D" type="MeshInstance2D" parent="."]
modulate = Color(0.359096, 0.426588, 0.599397, 1)
position = Vector2(320, 640)
scale = Vector2(640, 1280)
mesh = SubResource("QuadMesh_qfjsc")
[node name="Blocks" type="Node2D" parent="."]
[node name="Border" parent="." instance=ExtResource("4_3j08q")]
[node name="CollisionShape2D" parent="Border" index="0"]
position = Vector2(-64, 512)
shape = SubResource("RectangleShape2D_flipi")
[node name="Border2" parent="." instance=ExtResource("4_3j08q")]
[node name="CollisionShape2D" parent="Border2" index="0"]
position = Vector2(704, 512)
shape = SubResource("RectangleShape2D_flipi")
[node name="Bottom" parent="." instance=ExtResource("5_14njh")]
position = Vector2(320, 1312)
collision_layer = 8
collision_mask = 4
[node name="CollisionShape2D" parent="Bottom" index="0"]
shape = SubResource("RectangleShape2D_rxd0s")
[node name="Spawnpoint" type="Marker2D" parent="."]
position = Vector2(320, -64)
[node name="RowTests" type="Node2D" parent="."]
[node name="rowTest" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 1248)
[node name="rowTest2" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 1184)
[node name="rowTest3" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 1120)
[node name="rowTest4" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 1056)
[node name="rowTest5" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 992)
[node name="rowTest6" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 928)
[node name="rowTest7" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 864)
[node name="rowTest8" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 800)
[node name="rowTest9" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 736)
[node name="rowTest10" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 672)
[node name="rowTest11" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 608)
[node name="rowTest12" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 544)
[node name="rowTest13" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 480)
[node name="rowTest14" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 416)
[node name="rowTest15" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 352)
[node name="rowTest16" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 288)
[node name="rowTest17" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 224)
[node name="rowTest18" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 160)
[node name="rowTest19" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 96)
[node name="rowTest20" parent="RowTests" instance=ExtResource("4_si3v6")]
position = Vector2(0, 32)
[editable path="Border"]
[editable path="Border2"]
[editable path="Bottom"]

7
scenes/Grid/row_test.gd Normal file
View file

@ -0,0 +1,7 @@
extends Area2D
func _physics_process(delta: float) -> void:
if get_overlapping_areas().size() == 10 and GLOBAL.currentBlock.stopped:
for i in get_overlapping_areas():
GLOBAL.points += i.points
i.queue_free()#get_parent().get_parent().split()

15
scenes/Grid/row_test.tscn Normal file
View file

@ -0,0 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://duubii5uu3lgq"]
[ext_resource type="Script" path="res://scenes/Grid/row_test.gd" id="1_a8m2k"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rkqoc"]
size = Vector2(640, 20)
[node name="rowTest" type="Area2D"]
collision_layer = 4
collision_mask = 2
script = ExtResource("1_a8m2k")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(320, 0)
shape = SubResource("RectangleShape2D_rkqoc")

View file

@ -0,0 +1,10 @@
extends Node2D
@onready var slider = $Path2D/Slider
func _physics_process(delta: float) -> void:
if not GLOBAL.hasSelectedSpeed:
if Input.is_action_just_pressed("stop"):
GLOBAL.hasSelectedSpeed = true
GLOBAL.currentSpeed = GLOBAL.SPEED.MAX
print()