Initial commit

This commit is contained in:
2026-01-21 23:51:53 +01:00
commit 60b208fee0
1703 changed files with 100223 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
[gd_scene load_steps=4 format=3 uid="uid://dwa766yx7axly"]
[ext_resource type="Texture2D" uid="uid://cub0eem47ktoj" path="res://assets/2D/SteeringMinigame/Astroid.png" id="1_x4x3j"]
[ext_resource type="Script" uid="uid://bdt2b0lde2vqk" path="res://scene/minigames/steering/astroid.gd" id="2_x64bv"]
[sub_resource type="CircleShape2D" id="CircleShape2D_x4x3j"]
radius = 21.2132
[node name="Astroid" type="Sprite2D"]
texture = ExtResource("1_x4x3j")
script = ExtResource("2_x64bv")
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_x4x3j")
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]

View File

@@ -0,0 +1,41 @@
[gd_scene load_steps=6 format=3 uid="uid://c1sjec311te5h"]
[ext_resource type="Script" uid="uid://ew8vld54loog" path="res://scene/minigames/steering/steering_minigame.gd" id="1_fjh6l"]
[ext_resource type="Texture2D" uid="uid://bhdmujkbbyti6" path="res://assets/2D/SteeringMinigame/SpacyBackground.png" id="2_2gwot"]
[ext_resource type="Texture2D" uid="uid://bp5exqkba4hr3" path="res://assets/2D/SteeringMinigame/Spaceship.png" id="3_2gwot"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2gwot"]
size = Vector2(20, 24)
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_2gwot"]
properties/0/path = NodePath("Spaceship:position")
properties/0/spawn = true
properties/0/replication_mode = 1
[node name="SteeringMinigame" type="Node2D"]
script = ExtResource("1_fjh6l")
[node name="background1" type="Sprite2D" parent="."]
position = Vector2(0, -511)
texture = ExtResource("2_2gwot")
offset = Vector2(128, 256)
flip_h = true
[node name="background2" type="Sprite2D" parent="."]
texture = ExtResource("2_2gwot")
offset = Vector2(128, 256)
[node name="Spaceship" type="Sprite2D" parent="."]
position = Vector2(128, 400)
texture = ExtResource("3_2gwot")
[node name="Area2D" type="Area2D" parent="Spaceship"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Spaceship/Area2D"]
position = Vector2(0, 4)
shape = SubResource("RectangleShape2D_2gwot")
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_2gwot")
[connection signal="area_entered" from="Spaceship/Area2D" to="." method="_on_area_2d_area_entered"]

View File

@@ -0,0 +1,15 @@
extends Sprite2D
var speed: float = 50.0
var rotationSpeed: float = PI/8
func _process(delta: float) -> void:
if position.y > 600:
queue_free()
position.y += delta * speed
rotation +=delta * rotationSpeed
func _on_area_2d_area_entered(_area: Area2D) -> void:
queue_free()

View File

@@ -0,0 +1 @@
uid://bdt2b0lde2vqk

View File

@@ -0,0 +1,101 @@
extends Node2D
@onready var background1 = $background1
@onready var background2 = $background2
@onready var spaceship = $Spaceship
@onready var spaceshipHitbox = $Spaceship/Area2D
@onready var astroid = preload("res://scene/minigames/steering/Astroid.tscn")
@export var shipLogicRef: ShipLogic
var controllStick: Node3D
var controllStickGoalPos: float = 0.0
const CONTROLL_STICK_SNAPBACK: float = 24
var idleMoveAmplitude: float = 15
var timePassed: float = 0
var astroidTimer: float = 0
var scrollSpeed: float = 8.5 #Pixels per seccond
signal collision
const POS_LEFT = 64
const POS_MIDDLE = 128
const POS_RIGHT = 192
var starshipGoalPos: int = 1
const starshipHorizontalSpeed: float = 56
var rng = RandomNumberGenerator.new()
var active: bool = false
func _process(delta: float) -> void:
timePassed += delta
astroidTimer += delta
background1.position.y += scrollSpeed * delta
background2.position.y += scrollSpeed * delta
spaceship.position.y += idleMoveAmplitude * sin(timePassed)*delta
if controllStick:
controllStick.rotation_degrees.x = move_toward(controllStick.rotation_degrees.x,controllStickGoalPos,delta*CONTROLL_STICK_SNAPBACK)
if abs(controllStick.rotation_degrees.x) > 15:
controllStickGoalPos = 0
if astroidTimer >= 90:
astroidTimer = rng.randf_range(0,20)
var astroidCounter = 0
if rng.randf() > 0.5:
spawnAstroid(POS_LEFT)
astroidCounter += 1
if rng.randf() > 0.5:
spawnAstroid(POS_MIDDLE)
astroidCounter += 1
if rng.randf() > 0.5 and astroidCounter < 2:
spawnAstroid(POS_RIGHT)
infiniteScroll(background1)
infiniteScroll(background2)
spaceship.position.x = move_toward(spaceship.position.x,goalPosToPos(),starshipHorizontalSpeed*delta)
if active:
if Input.is_action_just_pressed("moveLeft"):
starshipGoalPos = clamp(starshipGoalPos-1,0,2)
if controllStick:
controllStickGoalPos = -16
if Input.is_action_just_pressed("moveRight"):
starshipGoalPos = clamp(starshipGoalPos+1,0,2)
if controllStick:
controllStickGoalPos = 16
if Input.is_action_just_pressed("interact") or Input.is_action_just_pressed("moveDown"):
active = false
func goalPosToPos() -> float:
match starshipGoalPos:
0:
return POS_LEFT
1:
return POS_MIDDLE
2:
return POS_RIGHT
return POS_MIDDLE
func activate() -> void:
active = true
func infiniteScroll(sprite: Sprite2D):
if sprite.position.y >=511:
sprite.position.y = -511
func spawnAstroid(Xpos: float):
var instance = astroid.instantiate()
add_child(instance)
instance.position = Vector2(Xpos,-10)
instance.speed = rng.randf_range(3,9)
instance.rotationSpeed = PI/16
func _on_area_2d_area_entered(_area: Area2D) -> void:
collision.emit()

View File

@@ -0,0 +1 @@
uid://ew8vld54loog