stars
This commit is contained in:
parent
cb3d54b9c2
commit
6b92473eeb
5 changed files with 368 additions and 1 deletions
35
objects/starfield/starfield.gd
Normal file
35
objects/starfield/starfield.gd
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
extends SubViewport
|
||||||
|
|
||||||
|
@export var outrun = false
|
||||||
|
@export var galaga = false
|
||||||
|
@export var gradius = false
|
||||||
|
@export var snow = false
|
||||||
|
@export var slowrun = false
|
||||||
|
@export var letters = false
|
||||||
|
@export var background = true
|
||||||
|
#const FadeTrail = preload("res://shaders/fade_trail.gd")
|
||||||
|
@export var trail_modulate: Color = Color.WHITE
|
||||||
|
@export var trail_fade_speed: float = 2.0
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
if outrun: $OutrunInSpace.visible = true
|
||||||
|
if galaga: $Galaga.visible = true
|
||||||
|
if gradius: $Gradius.visible = true
|
||||||
|
if snow: $Snow.visible = true
|
||||||
|
if slowrun: $SlowRun.visible = true
|
||||||
|
if letters:
|
||||||
|
$Letters.visible = true
|
||||||
|
%FadeTimer.start()
|
||||||
|
if !background: $ColorRect.visible = false
|
||||||
|
|
||||||
|
|
||||||
|
func _on_fade_timer_timeout() -> void:
|
||||||
|
# 0 to duplicate so it does not make an instance
|
||||||
|
var graphics_copy := %Letters.duplicate(0)
|
||||||
|
#graphics_copy.set_script(FadeTrail)
|
||||||
|
graphics_copy.modulate = trail_modulate
|
||||||
|
graphics_copy.global_position = %Letters.global_position
|
||||||
|
graphics_copy.z_index = 0
|
||||||
|
graphics_copy.fade_speed = trail_fade_speed
|
||||||
|
%Trail.add_child(graphics_copy)
|
||||||
1
objects/starfield/starfield.gd.uid
Normal file
1
objects/starfield/starfield.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dl4vxxuixelse
|
||||||
281
objects/starfield/starfield.tscn
Normal file
281
objects/starfield/starfield.tscn
Normal file
|
|
@ -0,0 +1,281 @@
|
||||||
|
[gd_scene load_steps=23 format=3 uid="uid://q2fys6o0jy6w"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dl4vxxuixelse" path="res://objects/starfield/starfield.gd" id="1_byu57"]
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_tjtqu"]
|
||||||
|
_limits = [0.0, 2.0, 0.0, 1.0]
|
||||||
|
_data = [Vector2(0, 0), 0.0, 2.01293, 0, 0, Vector2(1, 2), 0.0, 0.0, 0, 0]
|
||||||
|
point_count = 2
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id="CurveTexture_3lb2p"]
|
||||||
|
width = 32
|
||||||
|
curve = SubResource("Curve_tjtqu")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_afr3g"]
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
emission_shape = 6
|
||||||
|
emission_ring_axis = Vector3(0, 0, 1)
|
||||||
|
emission_ring_height = 1.0
|
||||||
|
emission_ring_radius = 48.0
|
||||||
|
emission_ring_inner_radius = 32.0
|
||||||
|
emission_ring_cone_angle = 90.0
|
||||||
|
gravity = Vector3(0, 0, 0)
|
||||||
|
radial_accel_min = 400.0
|
||||||
|
radial_accel_max = 400.0
|
||||||
|
scale_max = 2.0
|
||||||
|
scale_curve = SubResource("CurveTexture_3lb2p")
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_t8jhp"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(112, 120)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_hb6by"]
|
||||||
|
resource_name = "swerve"
|
||||||
|
length = 2.0
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:position")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.2, 1.6, 2),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(112, 120), Vector2(200, 160), Vector2(160, 80), Vector2(112, 120)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_nw3gf"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_t8jhp"),
|
||||||
|
&"swerve": SubResource("Animation_hb6by")
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_d236f"]
|
||||||
|
offsets = PackedFloat32Array(0, 0.228395, 0.475309, 0.685185, 0.864198)
|
||||||
|
colors = PackedColorArray(0.856415, 0.974311, 0.857279, 1, 0.601432, 0.939531, 0.966434, 1, 0.863622, 0.857662, 0.982583, 1, 0.992673, 0.815953, 0.887374, 1, 0.971926, 0.86632, 0.537952, 1)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture1D" id="GradientTexture1D_bm6wf"]
|
||||||
|
gradient = SubResource("Gradient_d236f")
|
||||||
|
width = 16
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_iodnb"]
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
emission_shape = 3
|
||||||
|
emission_box_extents = Vector3(160, 160, 1)
|
||||||
|
direction = Vector3(0, 1.5, 0)
|
||||||
|
spread = 0.0
|
||||||
|
initial_velocity_min = 32.0
|
||||||
|
initial_velocity_max = 48.0
|
||||||
|
gravity = Vector3(0, 0, 0)
|
||||||
|
color_ramp = SubResource("GradientTexture1D_bm6wf")
|
||||||
|
|
||||||
|
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_06bc3"]
|
||||||
|
particles_animation = true
|
||||||
|
particles_anim_h_frames = 26
|
||||||
|
particles_anim_v_frames = 1
|
||||||
|
particles_anim_loop = true
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_cb3se"]
|
||||||
|
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||||
|
point_count = 2
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id="CurveTexture_ql8w1"]
|
||||||
|
width = 182
|
||||||
|
curve = SubResource("Curve_cb3se")
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_gv1f1"]
|
||||||
|
offsets = PackedFloat32Array(0, 0.183857, 0.470852, 0.789238, 1)
|
||||||
|
colors = PackedColorArray(0, 1, 0, 1, 0.0941176, 0.411765, 0.0941176, 1, 0, 0, 0, 1, 0.0941176, 0.411765, 0.0941176, 1, 0, 1, 0, 1)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture1D" id="GradientTexture1D_2h68i"]
|
||||||
|
gradient = SubResource("Gradient_gv1f1")
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_kbguw"]
|
||||||
|
offsets = PackedFloat32Array(0, 0.529148, 1)
|
||||||
|
colors = PackedColorArray(0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture1D" id="GradientTexture1D_pr52d"]
|
||||||
|
gradient = SubResource("Gradient_kbguw")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_hbfks"]
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
emission_shape = 3
|
||||||
|
emission_box_extents = Vector3(180, 160, 1)
|
||||||
|
direction = Vector3(0, 1, 0)
|
||||||
|
spread = 0.0
|
||||||
|
initial_velocity_min = 32.0
|
||||||
|
initial_velocity_max = 48.0
|
||||||
|
gravity = Vector3(0, 0, 0)
|
||||||
|
color_ramp = SubResource("GradientTexture1D_pr52d")
|
||||||
|
color_initial_ramp = SubResource("GradientTexture1D_2h68i")
|
||||||
|
anim_offset_curve = SubResource("CurveTexture_ql8w1")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_kygel"]
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
emission_shape = 3
|
||||||
|
emission_box_extents = Vector3(160, 160, 1)
|
||||||
|
direction = Vector3(0, 1, 0)
|
||||||
|
spread = 0.0
|
||||||
|
initial_velocity_min = 32.0
|
||||||
|
initial_velocity_max = 48.0
|
||||||
|
gravity = Vector3(0, 0, 0)
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_ey4k6"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:skew")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [0.0]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_43jiu"]
|
||||||
|
resource_name = "snow"
|
||||||
|
length = 4.0
|
||||||
|
loop_mode = 1
|
||||||
|
step = 1.0
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:skew")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1, 2, 3),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [0.0, 0.785398, 0.0, -0.785398]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7v6u4"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_ey4k6"),
|
||||||
|
&"snow": SubResource("Animation_43jiu")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="SubViewport" type="SubViewport"]
|
||||||
|
transparent_bg = true
|
||||||
|
handle_input_locally = false
|
||||||
|
snap_2d_vertices_to_pixel = true
|
||||||
|
size = Vector2i(1440, 1080)
|
||||||
|
size_2d_override = Vector2i(360, 270)
|
||||||
|
size_2d_override_stretch = true
|
||||||
|
render_target_clear_mode = 2
|
||||||
|
render_target_update_mode = 4
|
||||||
|
script = ExtResource("1_byu57")
|
||||||
|
galaga = true
|
||||||
|
trail_fade_speed = 0.1
|
||||||
|
|
||||||
|
[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="TextureRect" type="TextureRect" parent="."]
|
||||||
|
modulate = Color(1, 1, 1, 0.75)
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="OutrunInSpace" type="GPUParticles2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(112, 120)
|
||||||
|
amount = 96
|
||||||
|
lifetime = 1.2
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_afr3g")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="OutrunInSpace"]
|
||||||
|
libraries = {
|
||||||
|
&"": SubResource("AnimationLibrary_nw3gf")
|
||||||
|
}
|
||||||
|
autoplay = "swerve"
|
||||||
|
speed_scale = 0.25
|
||||||
|
|
||||||
|
[node name="SlowRun" type="GPUParticles2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(112, 120)
|
||||||
|
amount = 96
|
||||||
|
lifetime = 1.2
|
||||||
|
speed_scale = 0.5
|
||||||
|
fixed_fps = 60
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_afr3g")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="SlowRun"]
|
||||||
|
libraries = {
|
||||||
|
&"": SubResource("AnimationLibrary_nw3gf")
|
||||||
|
}
|
||||||
|
autoplay = "swerve"
|
||||||
|
speed_scale = 0.25
|
||||||
|
|
||||||
|
[node name="Galaga" type="GPUParticles2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(160, 120)
|
||||||
|
amount = 128
|
||||||
|
preprocess = 1.0
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_iodnb")
|
||||||
|
|
||||||
|
[node name="Letters" type="GPUParticles2D" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
material = SubResource("CanvasItemMaterial_06bc3")
|
||||||
|
position = Vector2(160, 120)
|
||||||
|
preprocess = 1.0
|
||||||
|
fixed_fps = 60
|
||||||
|
interpolate = false
|
||||||
|
local_coords = true
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_hbfks")
|
||||||
|
|
||||||
|
[node name="Snow" type="GPUParticles2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(160, 120)
|
||||||
|
amount = 128
|
||||||
|
preprocess = 1.0
|
||||||
|
randomness = 0.44
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_kygel")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="Snow"]
|
||||||
|
libraries = {
|
||||||
|
&"": SubResource("AnimationLibrary_7v6u4")
|
||||||
|
}
|
||||||
|
autoplay = "snow"
|
||||||
|
|
||||||
|
[node name="Gradius" type="GPUParticles2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(210, 120)
|
||||||
|
rotation = 1.5708
|
||||||
|
amount = 128
|
||||||
|
preprocess = 1.0
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_iodnb")
|
||||||
|
|
||||||
|
[node name="Trail" type="Node" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
|
||||||
|
[node name="FadeTimer" type="Timer" parent="Trail"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
wait_time = 0.05
|
||||||
|
|
||||||
|
[connection signal="timeout" from="Trail/FadeTimer" to="." method="_on_fade_timer_timeout"]
|
||||||
41
objects/starfield/starfield_test.tscn
Normal file
41
objects/starfield/starfield_test.tscn
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://dicavpvkfh86p"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://q2fys6o0jy6w" path="res://objects/starfield/starfield.tscn" id="1_4yvqf"]
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_htoqv"]
|
||||||
|
resource_name = "StarfieldTest"
|
||||||
|
script/source = "extends Control
|
||||||
|
|
||||||
|
@onready var texture_rect: TextureRect = $SubViewportContainer/SubViewport/TextureRect
|
||||||
|
@onready var sub_viewport: SubViewport = $SubViewportContainer/SubViewport
|
||||||
|
|
||||||
|
var texture: ImageTexture
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
texture = ImageTexture.create_from_image(sub_viewport.get_texture().get_image())
|
||||||
|
texture_rect.texture = texture
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
texture.update(sub_viewport.get_texture().get_image())
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="StarfieldTest" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = SubResource("GDScript_htoqv")
|
||||||
|
|
||||||
|
[node name="SubViewportContainer" type="SubViewportContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
stretch = true
|
||||||
|
|
||||||
|
[node name="SubViewport" parent="SubViewportContainer" instance=ExtResource("1_4yvqf")]
|
||||||
|
size = Vector2i(240, 320)
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://dfwa3gwtoor3t"]
|
[gd_scene load_steps=8 format=3 uid="uid://dfwa3gwtoor3t"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cokpdf3gw10kr" path="res://space.png" id="1_ikr60"]
|
[ext_resource type="Texture2D" uid="uid://cokpdf3gw10kr" path="res://space.png" id="1_ikr60"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c714s5d7d5765" path="res://objects/player/player.tscn" id="2_ikr60"]
|
[ext_resource type="PackedScene" uid="uid://c714s5d7d5765" path="res://objects/player/player.tscn" id="2_ikr60"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b1rm2x7lofhkm" path="res://objects/bosses/tesu.tscn" id="4_mmy68"]
|
[ext_resource type="PackedScene" uid="uid://b1rm2x7lofhkm" path="res://objects/bosses/tesu.tscn" id="4_mmy68"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://q2fys6o0jy6w" path="res://objects/starfield/starfield.tscn" id="5_e0h7n"]
|
||||||
[ext_resource type="AudioStream" uid="uid://dftw8ufcgjbft" path="res://audio/music/04 - Stage 2 (Purple Sea).mp3" id="5_wcm38"]
|
[ext_resource type="AudioStream" uid="uid://dftw8ufcgjbft" path="res://audio/music/04 - Stage 2 (Purple Sea).mp3" id="5_wcm38"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ikr60"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ikr60"]
|
||||||
|
|
@ -13,7 +14,15 @@ size = Vector2(260, 11.25)
|
||||||
|
|
||||||
[node name="TestScene" type="Node"]
|
[node name="TestScene" type="Node"]
|
||||||
|
|
||||||
|
[node name="SubViewportContainer" type="SubViewportContainer" parent="."]
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 40.0
|
||||||
|
|
||||||
|
[node name="SubViewport" parent="SubViewportContainer" instance=ExtResource("5_e0h7n")]
|
||||||
|
size = Vector2i(240, 320)
|
||||||
|
|
||||||
[node name="Icon" type="Sprite2D" parent="."]
|
[node name="Icon" type="Sprite2D" parent="."]
|
||||||
|
visible = false
|
||||||
position = Vector2(120, 160)
|
position = Vector2(120, 160)
|
||||||
texture = ExtResource("1_ikr60")
|
texture = ExtResource("1_ikr60")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue