player and level

This commit is contained in:
Patrick Nueser
2024-06-27 10:53:06 +02:00
parent 27b9bb4777
commit 5a321ed45b
6 changed files with 226 additions and 1 deletions

17
level_bg/level_bg.gd Normal file
View File

@ -0,0 +1,17 @@
extends ParallaxBackground
@onready var parallax_layer = $ParallaxLayer
@onready var parallax_layer_2 = $ParallaxLayer2
@onready var parallax_layer_3 = $ParallaxLayer3
const SPEED: float = 200.0
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
parallax_layer.motion_offset.y += SPEED * delta * 0.2
parallax_layer_2.motion_offset.y += SPEED * delta * 0.3
parallax_layer_3.motion_offset.y += SPEED * delta * 0.33
func set_running(running: bool) -> void:
set_process(running)

35
level_bg/level_bg.tscn Normal file
View File

@ -0,0 +1,35 @@
[gd_scene load_steps=4 format=3 uid="uid://dp67krj08qdxb"]
[ext_resource type="Script" path="res://level_bg/level_bg.gd" id="1_kebk5"]
[ext_resource type="Texture2D" uid="uid://d3q42ga40cxwc" path="res://assets/backgrounds/spr_stars01.png" id="1_or7w4"]
[ext_resource type="Texture2D" uid="uid://dh40gp276y6p6" path="res://assets/backgrounds/spr_stars02.png" id="2_vqmxu"]
[node name="LevelBg" type="ParallaxBackground"]
script = ExtResource("1_kebk5")
[node name="ColorRect" type="ColorRect" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 1)
[node name="ParallaxLayer" type="ParallaxLayer" parent="."]
motion_mirroring = Vector2(2.08165e-12, 2560)
[node name="Sprite2D" type="Sprite2D" parent="ParallaxLayer"]
texture = ExtResource("1_or7w4")
[node name="ParallaxLayer2" type="ParallaxLayer" parent="."]
motion_mirroring = Vector2(2.08165e-12, 2560)
[node name="Sprite2D" type="Sprite2D" parent="ParallaxLayer2"]
texture = ExtResource("2_vqmxu")
[node name="ParallaxLayer3" type="ParallaxLayer" parent="."]
motion_offset = Vector2(2.08165e-12, 600)
motion_mirroring = Vector2(2.08165e-12, 2560)
[node name="Sprite2D" type="Sprite2D" parent="ParallaxLayer3"]
texture = ExtResource("2_vqmxu")