Init commit Intro scene implemented

This commit is contained in:
Stephen Seo 2024-04-13 12:22:12 +09:00
commit 935263cc59
17 changed files with 433 additions and 0 deletions

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/

123
MainLogic.gd Normal file
View file

@ -0,0 +1,123 @@
extends Node2D
@onready var main_label = $Camera2D/MainLabel
@onready var lower_label = $Camera2D/LowerLabel
@onready var fire_diamond = $FireDiamond
@onready var water_diamond = $WaterDiamond
@onready var wind_diamond = $WindDiamond
@onready var earth_diamond = $EarthDiamond
@onready var audio_stream_player = $AudioStreamPlayer
const start_text = "You seek the elementals?\nProve your worth!\nShow the elements your mastery over summoning, and they are yours!"
const diamond_angle_rate = 1.2
const diamond_dist_rate = 50.0
const diamond_start_dist = 800.0
const diamond_min_dist = 150.0
enum StateT {Start, Start_TextRendered, Start_Stopping, MainMenu}
static var state_dict = {}
var tween_volume
var diamonds_gone = false
# Called when the node enters the scene tree for the first time.
func _ready():
if not state_dict.has("state"):
state_dict["state"] = StateT.Start
state_dict["timer"] = 0.0
state_dict["text_idx"] = 0
state_dict["start_diamonds"] = {
"dist": diamond_start_dist,
"angle" : 0.0
}
audio_stream_player.play()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
state_dict["timer"] += delta
match state_dict["state"]:
StateT.Start:
if state_dict["timer"] > 0.15:
main_label.text += start_text[state_dict["text_idx"]]
state_dict["text_idx"] += 1
state_dict["timer"] = 0.0
if state_dict["text_idx"] >= start_text.length():
state_dict["state"] = StateT.Start_TextRendered
state_dict["text_idx"] = 0
update_start_diamonds(delta)
StateT.Start_TextRendered:
update_start_diamonds(delta)
lower_label.text = "(Press \"Confirm\" to continue! Z, Enter, Space, or A on gamepad.)"
StateT.Start_Stopping:
update_stop_diamonds(delta)
StateT.MainMenu:
update_stop_diamonds(delta)
_:
pass
func _unhandled_input(event):
if event.is_pressed() and event.is_action("Confirm"):
match state_dict["state"]:
StateT.Start:
main_label.text = start_text
state_dict["state"] = StateT.Start_TextRendered
state_dict["text_idx"] = 0
state_dict["timer"] = 0.0
StateT.Start_TextRendered:
state_dict["state"] = StateT.Start_Stopping
tween_volume = get_tree().create_tween()
tween_volume.tween_property(audio_stream_player, "volume_db", -80.0, 4.0)
tween_volume.tween_callback(start_volume_tween_callback)
main_label.text = ""
lower_label.text = ""
_:
pass
func start_volume_tween_callback():
audio_stream_player.stop()
state_dict["state"] = StateT.MainMenu
func diamond_position_update():
fire_diamond.position.x = cos(state_dict["start_diamonds"]["angle"]) * state_dict["start_diamonds"]["dist"]
fire_diamond.position.y = sin(state_dict["start_diamonds"]["angle"]) * state_dict["start_diamonds"]["dist"]
water_diamond.position.x = cos(state_dict["start_diamonds"]["angle"] - PI / 2.0) * state_dict["start_diamonds"]["dist"]
water_diamond.position.y = sin(state_dict["start_diamonds"]["angle"] - PI / 2.0) * state_dict["start_diamonds"]["dist"]
wind_diamond.position.x = cos(state_dict["start_diamonds"]["angle"] - PI) * state_dict["start_diamonds"]["dist"]
wind_diamond.position.y = sin(state_dict["start_diamonds"]["angle"] - PI) * state_dict["start_diamonds"]["dist"]
earth_diamond.position.x = cos(state_dict["start_diamonds"]["angle"] - PI * 3.0 / 2.0) * state_dict["start_diamonds"]["dist"]
earth_diamond.position.y = sin(state_dict["start_diamonds"]["angle"] - PI * 3.0 / 2.0) * state_dict["start_diamonds"]["dist"]
func update_start_diamonds(delta):
state_dict["start_diamonds"]["dist"] -= delta * diamond_dist_rate
if state_dict["start_diamonds"]["dist"] < diamond_min_dist:
state_dict["start_diamonds"]["dist"] = diamond_min_dist
state_dict["start_diamonds"]["angle"] += delta * diamond_angle_rate
if state_dict["start_diamonds"]["angle"] > PI * 2.0:
state_dict["start_diamonds"]["angle"] -= PI * 2.0
diamond_position_update()
func update_stop_diamonds(delta):
if diamonds_gone:
return
state_dict["start_diamonds"]["dist"] += delta * diamond_dist_rate * 1.8
if state_dict["start_diamonds"]["dist"] > diamond_start_dist:
state_dict["start_diamonds"]["dist"] = diamond_start_dist
diamonds_gone = true
fire_diamond.get_parent().remove_child(fire_diamond)
water_diamond.get_parent().remove_child(water_diamond)
wind_diamond.get_parent().remove_child(wind_diamond)
earth_diamond.get_parent().remove_child(earth_diamond)
state_dict["start_diamonds"]["angle"] += delta * diamond_angle_rate
if state_dict["start_diamonds"]["angle"] > PI * 2.0:
state_dict["start_diamonds"]["angle"] -= PI * 2.0
diamond_position_update()

BIN
audio/LD55_0.mp3 Normal file

Binary file not shown.

19
audio/LD55_0.mp3.import Normal file
View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://2epey2fmmtb2"
path="res://.godot/imported/LD55_0.mp3-da1ace2adcbcacfae63475f797abaa5b.mp3str"
[deps]
source_file="res://audio/LD55_0.mp3"
dest_files=["res://.godot/imported/LD55_0.mp3-da1ace2adcbcacfae63475f797abaa5b.mp3str"]
[params]
loop=true
loop_offset=0.0
bpm=0.0
beat_count=0
bar_beats=4

BIN
gimp/earth_diamond.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://varqu7luxowf"
path="res://.godot/imported/earth_diamond.png-d8e03d900a85ef2614bc19fe8b1f86cc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://gimp/earth_diamond.png"
dest_files=["res://.godot/imported/earth_diamond.png-d8e03d900a85ef2614bc19fe8b1f86cc.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
gimp/fire_diamond.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dafkwtrfngup"
path="res://.godot/imported/fire_diamond.png-64bad13456a8098686ae11d618f05ca2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://gimp/fire_diamond.png"
dest_files=["res://.godot/imported/fire_diamond.png-64bad13456a8098686ae11d618f05ca2.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
gimp/water_diamond.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://djwgnisoid4co"
path="res://.godot/imported/water_diamond.png-97cbf5adc5d0a015ae7766dd3c49a333.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://gimp/water_diamond.png"
dest_files=["res://.godot/imported/water_diamond.png-97cbf5adc5d0a015ae7766dd3c49a333.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
gimp/wind_diamond.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d2mxjcl50laoa"
path="res://.godot/imported/wind_diamond.png-5c1eb0eaee1106c2552916a0dedc41e4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://gimp/wind_diamond.png"
dest_files=["res://.godot/imported/wind_diamond.png-5c1eb0eaee1106c2552916a0dedc41e4.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

1
icon.svg Normal file
View file

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 950 B

37
icon.svg.import Normal file
View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c2dvhov0ufybb"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

46
main_scene.tscn Normal file
View file

@ -0,0 +1,46 @@
[gd_scene load_steps=7 format=3 uid="uid://ch52ervf073wd"]
[ext_resource type="Script" path="res://MainLogic.gd" id="1_43no1"]
[ext_resource type="Texture2D" uid="uid://varqu7luxowf" path="res://gimp/earth_diamond.png" id="2_hlcsm"]
[ext_resource type="Texture2D" uid="uid://dafkwtrfngup" path="res://gimp/fire_diamond.png" id="3_s037p"]
[ext_resource type="Texture2D" uid="uid://djwgnisoid4co" path="res://gimp/water_diamond.png" id="4_u6w6s"]
[ext_resource type="Texture2D" uid="uid://d2mxjcl50laoa" path="res://gimp/wind_diamond.png" id="5_3irym"]
[ext_resource type="AudioStream" uid="uid://2epey2fmmtb2" path="res://audio/LD55_0.mp3" id="6_3kpot"]
[node name="Node2D" type="Node2D"]
script = ExtResource("1_43no1")
[node name="Camera2D" type="Camera2D" parent="."]
[node name="MainLabel" type="Label" parent="Camera2D"]
z_index = 1
offset_left = -277.0
offset_top = -96.0
offset_right = 278.0
offset_bottom = 97.0
[node name="LowerLabel" type="Label" parent="Camera2D"]
z_index = 1
offset_left = -237.0
offset_top = 101.0
offset_right = 239.0
offset_bottom = 237.0
[node name="EarthDiamond" type="Sprite2D" parent="."]
position = Vector2(-913, -324)
texture = ExtResource("2_hlcsm")
[node name="FireDiamond" type="Sprite2D" parent="."]
position = Vector2(-945, -192)
texture = ExtResource("3_s037p")
[node name="WaterDiamond" type="Sprite2D" parent="."]
position = Vector2(-978, -61)
texture = ExtResource("4_u6w6s")
[node name="WindDiamond" type="Sprite2D" parent="."]
position = Vector2(-980, 90)
texture = ExtResource("5_3irym")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource("6_3kpot")

67
project.godot Normal file
View file

@ -0,0 +1,67 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="LD55"
run/main_scene="res://main_scene.tscn"
config/features=PackedStringArray("4.2", "GL Compatibility")
config/icon="res://icon.svg"
[input]
Confirm={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
]
}
Cancel={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":88,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
]
}
Left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
Right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
Up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
Down={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
environment/defaults/default_clear_color=Color(0.133333, 0.133333, 0.133333, 1)