crash and victory screens

This commit is contained in:
Page Asgardius 2023-09-08 13:55:16 -07:00
parent 474d358c43
commit ef98662322
13 changed files with 281 additions and 0 deletions

8
backgounds/Label3.gd Normal file
View file

@ -0,0 +1,8 @@
extends Label
func _process(delta: float) -> void:
var hour = int(Global.time / 3600000)
var min = int(Global.time / 60000) - (hour * 60)
var sec = int(Global.time / 1000) - (min * 60) - (hour * 3600)
set_text("Your time: " + str(hour) + ":" + str(min) + ":" + str(sec) + ":" + str(Global.time - (sec * 1000) - (min * 60000) - (hour * 3600000)));

View file

@ -16,8 +16,16 @@ func _process(delta):
if (Time.get_ticks_msec() - wait) >= 1000 && (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)):
#print("Mouse Click/Unclick at: ", event.position)
_title()
elif Input.is_key_pressed(KEY_C):
Global.live = 2
elif Input.is_key_pressed(KEY_V):
Global.live = 3
if Global.live == 0:
_title()
elif Global.live == 2:
_crash()
elif Global.live == 3:
_complete()
#pass
func _title():
@ -28,3 +36,23 @@ func _title():
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()
func _crash():
# This is like autoloading the scene, only
# it happens after already loading the main scene.
Global.time = Time.get_ticks_msec() - wait
get_tree().root.remove_child(galaxy)
get_tree().change_scene_to_file("res://backgounds/supernova.tscn")
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()
func _complete():
# This is like autoloading the scene, only
# it happens after already loading the main scene.
Global.time = Time.get_ticks_msec() - wait
get_tree().root.remove_child(galaxy)
get_tree().change_scene_to_file("res://backgounds/radio.tscn")
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()

29
backgounds/radio.gd Normal file
View file

@ -0,0 +1,29 @@
extends Node2D
var crash := AudioStreamPlayer.new()
# Called when the node enters the scene tree for the first time.
func _ready():
add_child(crash)
var titlemusic = load("res://sfx/complete.ogg")
crash.stream = titlemusic
crash.play(0)
#pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _input(event):
# Mouse in viewport coordinates.
if event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER):
#print("Mouse Click/Unclick at: ", event.position)
_title()
func _title():
# This is like autoloading the scene, only
# it happens after already loading the main scene.
get_tree().change_scene_to_file("res://title.tscn")
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()

45
backgounds/radio.tscn Normal file
View file

@ -0,0 +1,45 @@
[gd_scene load_steps=5 format=3 uid="uid://c4oc3wj8vu5p0"]
[ext_resource type="Script" path="res://backgounds/radio.gd" id="1_hxbaj"]
[ext_resource type="Texture2D" uid="uid://bows52y4q3suo" path="res://sprites/antenna.png" id="2_26tjs"]
[ext_resource type="Script" path="res://backgounds/Label3.gd" id="3_765rj"]
[ext_resource type="Script" path="res://fps.gd" id="4_5mydr"]
[node name="radio" type="Node2D"]
script = ExtResource("1_hxbaj")
[node name="TextureRect" type="TextureRect" parent="."]
offset_left = 438.0
offset_top = 14.0
offset_right = 864.0
offset_bottom = 751.0
scale = Vector2(1, 0.92)
texture = ExtResource("2_26tjs")
[node name="Label" type="Label" parent="."]
offset_left = 461.0
offset_top = 29.0
offset_right = 531.0
offset_bottom = 55.0
scale = Vector2(6.32794, 4.85128)
text = "Good Job"
[node name="Label2" type="Label" parent="."]
offset_left = 108.0
offset_top = 361.0
offset_right = 475.0
offset_bottom = 387.0
scale = Vector2(2.92998, 7.01768)
text = "Click here or press any button to return to title"
[node name="Label3" type="Label" parent="."]
offset_left = 158.0
offset_top = 593.0
offset_right = 198.0
offset_bottom = 616.0
script = ExtResource("3_765rj")
[node name="fps" type="Label" parent="."]
offset_right = 40.0
offset_bottom = 23.0
script = ExtResource("4_5mydr")

29
backgounds/supernova.gd Normal file
View file

@ -0,0 +1,29 @@
extends Node2D
var crash := AudioStreamPlayer.new()
# Called when the node enters the scene tree for the first time.
func _ready():
add_child(crash)
var titlemusic = load("res://sfx/crash.ogg")
crash.stream = titlemusic
crash.play(0)
#pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _input(event):
# Mouse in viewport coordinates.
if event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER):
#print("Mouse Click/Unclick at: ", event.position)
_title()
func _title():
# This is like autoloading the scene, only
# it happens after already loading the main scene.
get_tree().change_scene_to_file("res://title.tscn")
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()

BIN
backgounds/supernova.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 KiB

View file

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

42
backgounds/supernova.tscn Normal file
View file

@ -0,0 +1,42 @@
[gd_scene load_steps=5 format=3 uid="uid://cx3x5lteh72xk"]
[ext_resource type="Texture2D" uid="uid://bqyx3wu4vf408" path="res://backgounds/supernova.png" id="1_0bxam"]
[ext_resource type="Script" path="res://backgounds/supernova.gd" id="1_3jmy0"]
[ext_resource type="Script" path="res://backgounds/Label3.gd" id="3_h0a4u"]
[ext_resource type="Script" path="res://fps.gd" id="3_tbeol"]
[node name="supernova" type="Node2D"]
script = ExtResource("1_3jmy0")
[node name="TextureRect" type="TextureRect" parent="."]
offset_right = 1280.0
offset_bottom = 720.0
texture = ExtResource("1_0bxam")
[node name="Label" type="Label" parent="."]
offset_left = 59.0
offset_top = 89.0
offset_right = 99.0
offset_bottom = 112.0
scale = Vector2(6.32794, 4.85128)
text = "Your spaceship crashed"
[node name="Label2" type="Label" parent="."]
offset_left = 108.0
offset_top = 361.0
offset_right = 475.0
offset_bottom = 387.0
scale = Vector2(2.92998, 7.01768)
text = "Click here or press any button to return to title"
[node name="Label3" type="Label" parent="."]
offset_left = 158.0
offset_top = 593.0
offset_right = 198.0
offset_bottom = 616.0
script = ExtResource("3_h0a4u")
[node name="fps" type="Label" parent="."]
offset_right = 40.0
offset_bottom = 23.0
script = ExtResource("3_tbeol")

View file

@ -16,8 +16,16 @@ func _process(delta):
if (Time.get_ticks_msec() - wait) >= 1000 && (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)):
#print("Mouse Click/Unclick at: ", event.position)
_title()
elif Input.is_key_pressed(KEY_C):
Global.live = 2
elif Input.is_key_pressed(KEY_V):
Global.live = 3
if Global.live == 0:
_title()
elif Global.live == 2:
_crash()
elif Global.live == 3:
_complete()
#pass
func _title():
@ -28,3 +36,23 @@ func _title():
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()
func _crash():
# This is like autoloading the scene, only
# it happens after already loading the main scene.
Global.time = Time.get_ticks_msec() - wait
get_tree().root.remove_child(wormhole)
get_tree().change_scene_to_file("res://backgounds/supernova.tscn")
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()
func _complete():
# This is like autoloading the scene, only
# it happens after already loading the main scene.
Global.time = Time.get_ticks_msec() - wait
get_tree().root.remove_child(wormhole)
get_tree().change_scene_to_file("res://backgounds/radio.tscn")
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()

BIN
sfx/complete.ogg Normal file

Binary file not shown.

19
sfx/complete.ogg.import Normal file
View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://be5r2ycrspqn7"
path="res://.godot/imported/complete.ogg-9aa71416cd04dc3220e1f44b142c8cb9.oggvorbisstr"
[deps]
source_file="res://sfx/complete.ogg"
dest_files=["res://.godot/imported/complete.ogg-9aa71416cd04dc3220e1f44b142c8cb9.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

BIN
sfx/crash.ogg Normal file

Binary file not shown.

19
sfx/crash.ogg.import Normal file
View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://b6gfnaiy8x3v"
path="res://.godot/imported/crash.ogg-11a52fe708fb30358e38fc41556fd0d4.oggvorbisstr"
[deps]
source_file="res://sfx/crash.ogg"
dest_files=["res://.godot/imported/crash.ogg-11a52fe708fb30358e38fc41556fd0d4.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4