player and level
This commit is contained in:
17
level_bg/level_bg.gd
Normal file
17
level_bg/level_bg.gd
Normal 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
35
level_bg/level_bg.tscn
Normal 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")
|
Reference in New Issue
Block a user