mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 08:55:35 +00:00
Title screen rotating crystal
This commit is contained in:
parent
d25696425b
commit
9ae79d54bb
10 changed files with 406 additions and 1 deletions
227
Scenes/HUD/TitleCrystal.tscn
Normal file
227
Scenes/HUD/TitleCrystal.tscn
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
[gd_scene load_steps=34 format=3 uid="uid://bmj8t4pou6608"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://p242xo3qxwve" path="res://Sprites/UI/Crystal3.png" id="1_0eskd"]
|
||||
[ext_resource type="Script" uid="uid://w85hem1ec8cq" path="res://Scripts/Tools/AnimatedTextureRect.gd" id="1_n84ak"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_y7grm"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(640, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rs5p5"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(0, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gahdd"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(32, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ogjye"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(64, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cy8ro"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(96, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ljnfb"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(128, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_a22na"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(160, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hbsma"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(192, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xeco6"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(224, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dqjry"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(256, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hy5wk"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(288, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_aoyqx"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(320, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_d5eoa"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(352, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7isrm"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(384, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_py6u0"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(416, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_e18yr"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(448, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_g0nwx"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(480, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_olywa"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(512, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ektid"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(544, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_quqih"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(576, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3dbdb"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(608, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ayuam"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(672, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_d0spx"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(704, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hqb8r"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(736, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_iudy4"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(768, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_w08op"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(800, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_grtmq"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(832, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_aiviv"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(864, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_k136o"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(896, 0, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xxm62"]
|
||||
atlas = ExtResource("1_0eskd")
|
||||
region = Rect2(928, 0, 32, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_xxm62"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_rs5p5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gahdd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ogjye")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_cy8ro")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ljnfb")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_a22na")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hbsma")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xeco6")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dqjry")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hy5wk")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_aoyqx")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_d5eoa")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_7isrm")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_py6u0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_e18yr")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_g0nwx")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_olywa")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ektid")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_quqih")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3dbdb")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_y7grm")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ayuam")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_d0spx")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hqb8r")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_iudy4")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_w08op")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_grtmq")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_aiviv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_k136o")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xxm62")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="TitleCrystal" type="TextureRect"]
|
||||
texture = SubResource("AtlasTexture_y7grm")
|
||||
script = ExtResource("1_n84ak")
|
||||
Frames = SubResource("SpriteFrames_xxm62")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=18 format=3 uid="uid://5xajclchk3my"]
|
||||
[gd_scene load_steps=21 format=3 uid="uid://5xajclchk3my"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dql102fvubniv" path="res://Scripts/MainMenu.cs" id="1_702nk"]
|
||||
[ext_resource type="PackedScene" uid="uid://c84shrj84g4t2" path="res://Scenes/HUD/MusicRoom.tscn" id="2_if7li"]
|
||||
|
|
@ -12,10 +12,16 @@
|
|||
[ext_resource type="LabelSettings" uid="uid://wr7cb2qa6w71" path="res://Resources/Styles/Title_Text_Style.tres" id="7_loo7a"]
|
||||
[ext_resource type="StyleBox" uid="uid://ctw2hju32l3rg" path="res://Resources/Styles/PixelStyleBoxRed.tres" id="7_rrcx7"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3tyacxxw88lx" path="res://Scenes/Utils/StreamPlayerWithName.tscn" id="8_koqhg"]
|
||||
[ext_resource type="PackedScene" uid="uid://bmj8t4pou6608" path="res://Scenes/HUD/TitleCrystal.tscn" id="8_riqfo"]
|
||||
[ext_resource type="PackedScene" uid="uid://bemu3l6b1e84y" path="res://Scenes/HUD/debug_menu.tscn" id="9_nwlsr"]
|
||||
[ext_resource type="Texture2D" uid="uid://p242xo3qxwve" path="res://Sprites/UI/Crystal3.png" id="9_riqfo"]
|
||||
[ext_resource type="Texture2D" uid="uid://cv1fmski5dvhk" path="res://Sprites/Briefing/Intro/robot pov/l1_robot pov1.png" id="12_7467j"]
|
||||
[ext_resource type="Resource" uid="uid://byo74ews118nl" path="res://Resources/Music/No_Reason.tres" id="13_fh7cp"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cy8ro"]
|
||||
atlas = ExtResource("9_riqfo")
|
||||
region = Rect2(96, 0, 32, 16)
|
||||
|
||||
[sub_resource type="Theme" id="Theme_c7h4d"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_htmja"]
|
||||
|
|
@ -46,12 +52,21 @@ grow_vertical = 2
|
|||
texture = ExtResource("2_qdx0s")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
visible = false
|
||||
offset_left = 122.315
|
||||
offset_top = 21.375
|
||||
offset_right = 170.315
|
||||
offset_bottom = 61.375
|
||||
texture = ExtResource("2_j4e6a")
|
||||
|
||||
[node name="TitleCrystal" parent="." instance=ExtResource("8_riqfo")]
|
||||
offset_left = 160.36
|
||||
offset_top = 48.765
|
||||
offset_right = 192.36
|
||||
offset_bottom = 64.765
|
||||
rotation = 3.14159
|
||||
texture = SubResource("AtlasTexture_cy8ro")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
|
|
|||
78
Scripts/Tools/AnimatedTextureRect.gd
Normal file
78
Scripts/Tools/AnimatedTextureRect.gd
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
@tool
|
||||
@icon("res://addons/AnimatedTextureRect/AnimatedTextureRect.png")
|
||||
extends TextureRect
|
||||
class_name AnimatedTextureRect
|
||||
|
||||
@export var Frames: SpriteFrames = null
|
||||
var _previous_frames: SpriteFrames = null
|
||||
var _current_animation: StringName = "default"
|
||||
var autoplay: StringName = ""
|
||||
var _current_frame: int
|
||||
var _frame_timer: float = 0.0
|
||||
var _animation_stopped: bool = false
|
||||
|
||||
# Signals
|
||||
signal animation_finished
|
||||
signal animation_changed
|
||||
signal animation_looped
|
||||
signal frame_changed
|
||||
signal sprite_frames_changed
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if !is_instance_valid(Frames): return
|
||||
|
||||
_frame_timer += delta
|
||||
|
||||
if Frames != _previous_frames:
|
||||
sprite_frames_changed.emit()
|
||||
_sprite_frames_changed()
|
||||
|
||||
var frame_FPS: float = 1.0 / Frames.get_animation_speed(_current_animation)
|
||||
var frame_delay: float = frame_FPS * Frames.get_frame_duration(_current_animation, _current_frame)
|
||||
|
||||
if !_animation_stopped:
|
||||
if _frame_timer > frame_delay:
|
||||
_frame_timer -= frame_delay
|
||||
_current_frame += 1
|
||||
frame_changed.emit()
|
||||
if _current_frame >= Frames.get_frame_count(_current_animation):
|
||||
if Frames.get_animation_loop(_current_animation):
|
||||
_current_frame = 0
|
||||
animation_looped.emit()
|
||||
else:
|
||||
_current_frame -= 1
|
||||
_animation_stopped = true
|
||||
animation_finished.emit()
|
||||
|
||||
texture = Frames.get_frame_texture(_current_animation, _current_frame)
|
||||
|
||||
func play(animation: StringName) -> void:
|
||||
for _names in Frames.get_animation_names():
|
||||
if animation == _names:
|
||||
if _current_animation != animation: animation_changed.emit()
|
||||
_current_animation = animation
|
||||
_animation_stopped = false
|
||||
return
|
||||
|
||||
func stop() -> void:
|
||||
_animation_stopped = true
|
||||
_frame_timer = 0.0
|
||||
|
||||
@warning_ignore("native_method_override")
|
||||
func get_class() -> String:
|
||||
return "AnimatedTextureRect"
|
||||
|
||||
func _sprite_frames_changed() -> void:
|
||||
if autoplay != "":
|
||||
_current_animation = autoplay
|
||||
else:
|
||||
if is_instance_valid(Frames):
|
||||
# Default to the first animation in the list
|
||||
_current_animation = Frames.get_animation_names()[0]
|
||||
else:
|
||||
_current_animation = "default"
|
||||
1
Scripts/Tools/AnimatedTextureRect.gd.uid
Normal file
1
Scripts/Tools/AnimatedTextureRect.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://w85hem1ec8cq
|
||||
9
Scripts/UI/AnimatedTexture.cs
Normal file
9
Scripts/UI/AnimatedTexture.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class AnimatedTexture : TextureRect
|
||||
{
|
||||
[Export] public int Rows { get; private set; } = 1;
|
||||
[Export] public int Columns { get; private set; } = 2;
|
||||
[Export] public int Fps { get; private set; } = 30;
|
||||
}
|
||||
1
Scripts/UI/AnimatedTexture.cs.uid
Normal file
1
Scripts/UI/AnimatedTexture.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dspx5xead3kv3
|
||||
BIN
Sprites/UI/Crystal2.png
(Stored with Git LFS)
Normal file
BIN
Sprites/UI/Crystal2.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/UI/Crystal2.png.import
Normal file
34
Sprites/UI/Crystal2.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ckaux6f3t6s21"
|
||||
path="res://.godot/imported/Crystal2.png-ea1b40558187df9b80763d00e0c0234b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/UI/Crystal2.png"
|
||||
dest_files=["res://.godot/imported/Crystal2.png-ea1b40558187df9b80763d00e0c0234b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
Sprites/UI/Crystal3.png
(Stored with Git LFS)
Normal file
BIN
Sprites/UI/Crystal3.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/UI/Crystal3.png.import
Normal file
34
Sprites/UI/Crystal3.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://p242xo3qxwve"
|
||||
path="res://.godot/imported/Crystal3.png-e79fe3536c65dda5cbca1a4623849d46.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/UI/Crystal3.png"
|
||||
dest_files=["res://.godot/imported/Crystal3.png-e79fe3536c65dda5cbca1a4623849d46.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Loading…
Add table
Add a link
Reference in a new issue