Add musics, gameover background, better desktop

This commit is contained in:
2-1-1-2 2023-02-26 17:24:17 +01:00
parent 82e11bcfb2
commit ee4bf46a85
34 changed files with 543 additions and 119 deletions

1
.gitattributes vendored
View file

@ -1,2 +1,3 @@
*.png filter=lfs diff=lfs merge=lfs -text *.png filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text *.ttf filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text

BIN
Assets/defeat/defeat + background.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/defeat + background.png-35f455001136f1d96b63d77fa477e488.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/defeat/defeat + background.png"
dest_files=[ "res://.import/defeat + background.png-35f455001136f1d96b63d77fa477e488.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
Assets/defeat/defeat.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/defeat.png-884da3cd14f7543feaa928f401dadd11.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/defeat/defeat.png"
dest_files=[ "res://.import/defeat.png-884da3cd14f7543feaa928f401dadd11.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -5,7 +5,6 @@ onready var me = $AnimatedSprite
onready var timer onready var timer
var limit_random var limit_random
var rng = RandomNumberGenerator.new() var rng = RandomNumberGenerator.new()
onready var button = $"../Button"
export(Array, String) var animations = ["green", "orange", "red"] export(Array, String) var animations = ["green", "orange", "red"]
# True if animation should change # True if animation should change
@ -14,44 +13,44 @@ var next = false
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
rng.randomize() rng.randomize()
reset_timer() reset_timer()
me.play(animations[0]) me.play(animations[0])
func reset_timer() -> void: func reset_timer() -> void:
timer = 0 timer = 0
limit_random = rng.randi_range(2, 10) limit_random = rng.randi_range(2, 10)
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta) -> void: func _process(delta) -> void:
timer += delta timer += delta
var max_frame = me.frames.get_frame_count(me.animation) - 1 var max_frame = me.frames.get_frame_count(me.animation) - 1
var current_anim_idx = animations.find(me.animation) var current_anim_idx = animations.find(me.animation)
if current_anim_idx >= animations.size() - 1: if current_anim_idx >= animations.size() - 1:
# Last animation reached # Last animation reached
check_next_animframe(max_frame, animations[0]) check_next_animframe(max_frame, animations[0])
else: else:
check_next_animframe(max_frame, animations[current_anim_idx + 1]) check_next_animframe(max_frame, animations[current_anim_idx + 1])
# Jump to next animation at the end of the current one # Jump to next animation at the end of the current one
func check_next_animframe(max_frame, next_animation) -> void: func check_next_animframe(max_frame, next_animation) -> void:
if me.frame == 0 and next: if me.frame == 0 and next:
me.play(next_animation) me.play(next_animation)
next = false next = false
if next_animation == animations[0]: if next_animation == animations[0]:
# Reset random for first animation # Reset random for first animation
reset_timer() reset_timer()
return return
if max_frame == me.frame: if max_frame == me.frame:
# Last frame of animation reached # Last frame of animation reached
next = true next = true
return return
if max_frame == -1 and timer >= limit_random: if max_frame == -1 and timer >= limit_random:
# No frame in animation, use time # No frame in animation, use time
next = true next = true
return return

View file

@ -5,8 +5,8 @@ onready var sprite = $"../Sprite"
func _on_Area2D_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void: func _on_Area2D_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
if event is InputEventMouseButton: if event is InputEventMouseButton:
event = event as InputEventMouseButton event = event as InputEventMouseButton
if event.pressed and event.button_index == BUTTON_LEFT: if event.pressed and event.button_index == BUTTON_LEFT:
screen.visible = true screen.visible = true
sprite.modulate = Color(0.66, 0.51, 0.85) # shade sprite.modulate = Color(0.66, 0.51, 0.85) # shade

View file

@ -8,32 +8,34 @@ onready var folder_icon = $"../../../Sprite"
func drag_change_state(): func drag_change_state():
is_dragging = !is_dragging is_dragging = !is_dragging
grabbed_offset = window.get_position() - get_global_mouse_position() grabbed_offset = window.get_position() - get_global_mouse_position()
func _process(_delta) -> void: func _process(_delta) -> void:
if is_dragging: if is_dragging:
var new_pos = get_global_mouse_position() + grabbed_offset var new_pos = get_global_mouse_position() + grabbed_offset
if new_pos.x > 300: if new_pos.x > 150:
window.set_position(new_pos) window.set_position(new_pos)
else: else:
drag_change_state() drag_change_state()
func _on_Area2D_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void: func _on_Area2D_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
if event is InputEventMouseButton: if event is InputEventMouseButton:
event = event as InputEventMouseButton event = event as InputEventMouseButton
if event.pressed and event.button_index == BUTTON_LEFT: if event.pressed and event.button_index == BUTTON_LEFT:
drag_change_state() drag_change_state()
elif event.button_index == BUTTON_LEFT and !event.pressed: #print("here haha")
drag_change_state() elif event.button_index == BUTTON_LEFT and !event.pressed:
drag_change_state()
#print("here huhu")
func _on_Area2D2_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void: func _on_Area2D2_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
if event is InputEventMouseButton: if event is InputEventMouseButton:
event = event as InputEventMouseButton event = event as InputEventMouseButton
if event.pressed and event.button_index == BUTTON_LEFT: if event.pressed and event.button_index == BUTTON_LEFT:
drag_change_state() drag_change_state()
window.visible = false window.visible = false
folder_icon.modulate = Color(1, 1, 1) # reset shade folder_icon.modulate = Color(1, 1, 1) # reset shade

View file

@ -10,9 +10,10 @@ extents = Vector2( 555, 60 )
extents = Vector2( 38.75, 38.75 ) extents = Vector2( 38.75, 38.75 )
[node name="Node2D" type="Node2D"] [node name="Node2D" type="Node2D"]
position = Vector2( 312, 248 )
[node name="Window" type="Sprite" parent="."] [node name="Window" type="Sprite" parent="."]
scale = Vector2( 0.4, 0.4 ) scale = Vector2( 0.3, 0.3 )
z_index = -3 z_index = -3
texture = ExtResource( 1 ) texture = ExtResource( 1 )
@ -30,7 +31,6 @@ script = ExtResource( 2 )
[node name="CloseButton" type="CollisionShape2D" parent="Window/Area2D2"] [node name="CloseButton" type="CollisionShape2D" parent="Window/Area2D2"]
position = Vector2( 486.25, -486.25 ) position = Vector2( 486.25, -486.25 )
scale = Vector2( 1, 1 )
shape = SubResource( 2 ) shape = SubResource( 2 )
[connection signal="input_event" from="Window/Area2D" to="Window/Area2D" method="_on_Area2D_input_event"] [connection signal="input_event" from="Window/Area2D" to="Window/Area2D" method="_on_Area2D_input_event"]

BIN
Musics/sound effect/alert.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/alert.wav-85a6ad3663ea25670897c2a404627b91.sample"
[deps]
source_file="res://Musics/sound effect/alert.wav"
dest_files=[ "res://.import/alert.wav-85a6ad3663ea25670897c2a404627b91.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=2
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View file

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/hover button.wav-d25979aa700344df5cc0f419db6c7b32.sample"
[deps]
source_file="res://Musics/sound effect/hover button.wav"
dest_files=[ "res://.import/hover button.wav-d25979aa700344df5cc0f419db6c7b32.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
Musics/sound effect/hower.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/hower.wav-5d62c49d3d4094a1154052b39a54640b.sample"
[deps]
source_file="res://Musics/sound effect/hower.wav"
dest_files=[ "res://.import/hower.wav-5d62c49d3d4094a1154052b39a54640b.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View file

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/hower_sound.wav-e91770a852ff03dc6cba00bc7bdd1938.sample"
[deps]
source_file="res://Musics/sound effect/hower_sound.wav"
dest_files=[ "res://.import/hower_sound.wav-e91770a852ff03dc6cba00bc7bdd1938.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
Musics/wav/defeat.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/defeat.wav-2a671024c0c7c713a50444568c6e46e1.sample"
[deps]
source_file="res://Musics/wav/defeat.wav"
dest_files=[ "res://.import/defeat.wav-2a671024c0c7c713a50444568c6e46e1.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=1
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
Musics/wav/eye v2.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/eye v2.wav-ce65053584f4024b10b293b171c1824d.sample"
[deps]
source_file="res://Musics/wav/eye v2.wav"
dest_files=[ "res://.import/eye v2.wav-ce65053584f4024b10b293b171c1824d.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=2
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
Musics/wav/eye.wav (Stored with Git LFS) Normal file

Binary file not shown.

23
Musics/wav/eye.wav.import Normal file
View file

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/eye.wav-32c76dcec42441a114c9a73745793b61.sample"
[deps]
source_file="res://Musics/wav/eye.wav"
dest_files=[ "res://.import/eye.wav-32c76dcec42441a114c9a73745793b61.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=2
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
Musics/wav/main.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/main.wav-0ae6feb07f028311de078a72b1d8d1be.sample"
[deps]
source_file="res://Musics/wav/main.wav"
dest_files=[ "res://.import/main.wav-0ae6feb07f028311de078a72b1d8d1be.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=2
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
Musics/wav/menu.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/menu.wav-66053d58b4fb142fa50ed174c2f5e920.sample"
[deps]
source_file="res://Musics/wav/menu.wav"
dest_files=[ "res://.import/menu.wav-66053d58b4fb142fa50ed174c2f5e920.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=2
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
Musics/wav/victory.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/victory.wav-f104b1114e6beada2ecf14f9fe6f3225.sample"
[deps]
source_file="res://Musics/wav/victory.wav"
dest_files=[ "res://.import/victory.wav-f104b1114e6beada2ecf14f9fe6f3225.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=2] [gd_scene load_steps=15 format=2]
[ext_resource path="res://Characters/Villain.tscn" type="PackedScene" id=1] [ext_resource path="res://Characters/Villain.tscn" type="PackedScene" id=1]
[ext_resource path="res://Elements/Directory.tscn" type="PackedScene" id=2] [ext_resource path="res://Elements/Directory.tscn" type="PackedScene" id=2]
@ -9,10 +9,15 @@
[ext_resource path="res://Assets/windows/windows.png" type="Texture" id=7] [ext_resource path="res://Assets/windows/windows.png" type="Texture" id=7]
[ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=8] [ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=8]
[ext_resource path="res://Elements/SquareWindow.tscn" type="PackedScene" id=9] [ext_resource path="res://Elements/SquareWindow.tscn" type="PackedScene" id=9]
[ext_resource path="res://Scenes/Scripts/Desktop.gd" type="Script" id=10]
[ext_resource path="res://Musics/wav/main.wav" type="AudioStream" id=11]
[ext_resource path="res://Musics/wav/eye v2.wav" type="AudioStream" id=12]
[ext_resource path="res://Musics/sound effect/alert.wav" type="AudioStream" id=13]
[sub_resource type="Theme" id=1] [sub_resource type="Theme" id=1]
[node name="Node2D" type="Node2D"] [node name="Node2D" type="Node2D"]
script = ExtResource( 10 )
[node name="Windows" type="Sprite" parent="."] [node name="Windows" type="Sprite" parent="."]
visible = false visible = false
@ -20,21 +25,6 @@ position = Vector2( 512, 358 )
z_index = -3 z_index = -3
texture = ExtResource( 7 ) texture = ExtResource( 7 )
[node name="Button" type="Button" parent="."]
margin_left = 374.0
margin_top = 317.0
margin_right = 651.0
margin_bottom = 386.0
theme = SubResource( 1 )
custom_colors/font_color = Color( 1, 1, 1, 1 )
custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 )
custom_fonts/font = ExtResource( 8 )
custom_styles/hover = ExtResource( 6 )
custom_styles/pressed = ExtResource( 5 )
custom_styles/normal = ExtResource( 4 )
text = "CLIQUE MOI"
script = ExtResource( 3 )
[node name="Villain" parent="." instance=ExtResource( 1 )] [node name="Villain" parent="." instance=ExtResource( 1 )]
position = Vector2( 871, 589 ) position = Vector2( 871, 589 )
scale = Vector2( 0.2, 0.2 ) scale = Vector2( 0.2, 0.2 )
@ -42,17 +32,38 @@ scale = Vector2( 0.2, 0.2 )
[node name="Directories" type="Node2D" parent="."] [node name="Directories" type="Node2D" parent="."]
[node name="Directory1" parent="Directories" instance=ExtResource( 2 )] [node name="Directory1" parent="Directories" instance=ExtResource( 2 )]
position = Vector2( 73, 147 ) position = Vector2( 64, 64 )
[node name="Screen" parent="Directories/Directory1" instance=ExtResource( 9 )] [node name="Screen" parent="Directories/Directory1" instance=ExtResource( 9 )]
visible = false visible = false
position = Vector2( 396, 195 ) position = Vector2( 271, 205 )
[node name="Directory2" parent="Directories" instance=ExtResource( 2 )] [node name="Button2" type="Button" parent="Directories/Directory1/Screen"]
position = Vector2( 73, 258 ) margin_left = -128.0
margin_top = -32.0
margin_right = 149.0
margin_bottom = 37.0
theme = SubResource( 1 )
custom_colors/font_color = Color( 1, 1, 1, 1 )
custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 )
custom_fonts/font = ExtResource( 8 )
custom_styles/hover = ExtResource( 6 )
custom_styles/pressed = ExtResource( 5 )
custom_styles/normal = ExtResource( 4 )
text = "./hack"
script = ExtResource( 3 )
[node name="Screen" parent="Directories/Directory2" instance=ExtResource( 9 )] [node name="MainMusic" type="AudioStreamPlayer" parent="."]
visible = false stream = ExtResource( 11 )
position = Vector2( 396, 195 ) volume_db = -80.0
autoplay = true
[connection signal="pressed" from="Button" to="Button" method="_on_Button_pressed"] [node name="EyeMusic" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 12 )
volume_db = -80.0
autoplay = true
[node name="Alert" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 13 )
[connection signal="pressed" from="Directories/Directory1/Screen/Button2" to="Directories/Directory1/Screen/Button2" method="_on_Button_pressed"]

View file

@ -1,25 +1,32 @@
extends Button extends Button
onready var villain = $"../Villain/AnimatedSprite" onready var villain = $"../../../../Villain/AnimatedSprite"
onready var villain_animations = $"../Villain".animations onready var villain_animations = $"../../../../Villain"
var etat = false var etat = false
var remplissage = 0;
const texture_pressed = preload("res://Assets/tres_button/hover-pressed.png") const texture_pressed = preload("res://Assets/tres_button/hover-pressed.png")
const texture_released = preload("res://Assets/tres_button/normal.png") const texture_released = preload("res://Assets/tres_button/normal.png")
# Called every frame. '_delta' is the elapsed time since the previous frame. # Called every frame. '_delta' is the elapsed time since the previous frame.
func _process(_delta) -> void: func _process(_delta) -> void:
if etat: if etat:
if villain.animation == villain_animations[-1]: if villain.animation == villain_animations.animations[-1]:
assert(get_tree().change_scene("res://Scenes/GameOver.tscn") == OK) assert(get_tree().change_scene("res://Scenes/gameover.tscn") == OK)
if(remplissage == 60*10): # fermer le dossier et enlever l'icone
etat = false
self.get_parent().get_parent().visible = false;
else :
remplissage+=1;
print(remplissage)
func _on_Button_pressed() -> void: func _on_Button_pressed() -> void:
etat = !etat etat = !etat
var new_stylebox_normal = self.get_stylebox("normal").duplicate() var new_stylebox_normal = self.get_stylebox("normal").duplicate()
if etat: if etat:
new_stylebox_normal.texture = texture_pressed new_stylebox_normal.texture = texture_pressed
else: else:
new_stylebox_normal.texture = texture_released new_stylebox_normal.texture = texture_released
self.add_stylebox_override("normal", new_stylebox_normal) self.add_stylebox_override("normal", new_stylebox_normal)

33
Scenes/Scripts/Desktop.gd Normal file
View file

@ -0,0 +1,33 @@
extends Node
onready var villain = $"Villain/AnimatedSprite"
onready var villain_animations = $"Villain"
onready var mainMusic = $"MainMusic"
onready var eyeMusic = $"EyeMusic"
onready var alert = $"Alert"
var rng = RandomNumberGenerator.new()
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
rng.randomize()
var nbDossier = rng.randi_range(0, 3)
for i in range(nbDossier):
var dossier = get_child(2).duplicate()
dossier.position = Vector2(dossier.position.x, dossier.position.y+150*(i+1))
dossier.set_z_index(dossier.get_z_index()+10*(i+1))
add_child(dossier)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta) -> void:
if villain.animation == villain_animations.animations[-1]:
mainMusic.set_volume_db(-80)
eyeMusic.set_volume_db(0)
if(alert.is_playing()):
alert.stop()
elif villain.animation == villain_animations.animations[1] :
if(!alert.is_playing()):
alert.play()
else :
mainMusic.set_volume_db(0)
eyeMusic.set_volume_db(-80)

View file

@ -1,5 +1,9 @@
extends Node2D extends Node2D
onready var hover_sound = $"Hover"
func _on_RestartButton_pressed() -> void: func _on_RestartButton_pressed() -> void:
assert(get_tree().change_scene("res://Scenes/Menu.tscn") == OK) assert(get_tree().change_scene("res://Scenes/menu.tscn") == OK)
func _on_RestartButton_mouse_entered() -> void:
hover_sound.play()

View file

@ -1,13 +1,25 @@
extends Control extends Control
onready var hover_sound = $"Hover"
func _on_PlayButton_pressed() -> void: func _on_PlayButton_pressed() -> void:
assert(get_tree().change_scene("res://Scenes/DesktopScreen.tscn") == OK) assert(get_tree().change_scene("res://Scenes/DesktopScreen.tscn") == OK)
func _on_Help_Button_pressed() -> void: func _on_Help_Button_pressed() -> void:
print("help me") print("help me")
func _on_Quit_Button_pressed() -> void: func _on_Quit_Button_pressed() -> void:
get_tree().quit() get_tree().quit()
func _on_PlayButton_mouse_entered() -> void:
hover_sound.play()
func _on_Quit_Button_mouse_entered() -> void:
hover_sound.play()
func _on_Help_Button_mouse_entered() -> void:
hover_sound.play()

View file

@ -1,34 +1,38 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://Scenes/Scripts/GameOver.gd" type="Script" id=1] [ext_resource path="res://Scenes/Scripts/GameOver.gd" type="Script" id=1]
[ext_resource path="res://Assets/defeat/defeat + background.png" type="Texture" id=2]
[ext_resource path="res://Assets/tres_button/normal.tres" type="StyleBox" id=3] [ext_resource path="res://Assets/tres_button/normal.tres" type="StyleBox" id=3]
[ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=4] [ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=4]
[ext_resource path="res://Assets/tres_button/hover.tres" type="StyleBox" id=5] [ext_resource path="res://Assets/tres_button/hover.tres" type="StyleBox" id=5]
[ext_resource path="res://Assets/windows/windows.png" type="Texture" id=6] [ext_resource path="res://Musics/wav/defeat.wav" type="AudioStream" id=6]
[ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=7] [ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=7]
[ext_resource path="res://Musics/sound effect/hower.wav" type="AudioStream" id=8]
[node name="Node2D" type="Node2D"] [node name="Node2D" type="Node2D"]
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="Windows" type="Sprite" parent="."] [node name="Windows" type="Sprite" parent="."]
position = Vector2( 512, 360 ) position = Vector2( 512, 360 )
scale = Vector2( 0.5, 0.5 )
z_index = -2 z_index = -2
texture = ExtResource( 6 ) texture = ExtResource( 2 )
[node name="LabelGameOver" type="Label" parent="."] [node name="LabelGameOver" type="Label" parent="."]
margin_left = 427.0 margin_left = 422.0
margin_top = 338.0 margin_top = 147.0
margin_right = 609.0 margin_right = 604.0
margin_bottom = 368.0 margin_bottom = 177.0
rect_rotation = -14.1
custom_colors/font_color = Color( 0, 0, 0, 1 ) custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = ExtResource( 7 ) custom_fonts/font = ExtResource( 7 )
text = "GAME OVER" text = "GAME OVER"
[node name="RestartButton" type="Button" parent="."] [node name="RestartButton" type="Button" parent="."]
margin_left = 312.0 margin_left = 312.0
margin_top = 384.0 margin_top = 632.0
margin_right = 724.0 margin_right = 724.0
margin_bottom = 445.0 margin_bottom = 693.0
custom_colors/font_color = Color( 1, 1, 1, 1 ) custom_colors/font_color = Color( 1, 1, 1, 1 )
custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 ) custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 )
custom_fonts/font = ExtResource( 7 ) custom_fonts/font = ExtResource( 7 )
@ -40,4 +44,12 @@ __meta__ = {
"_edit_use_anchors_": true "_edit_use_anchors_": true
} }
[node name="DefeatMusic" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 6 )
autoplay = true
[node name="Hover" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 8 )
[connection signal="mouse_entered" from="RestartButton" to="." method="_on_RestartButton_mouse_entered"]
[connection signal="pressed" from="RestartButton" to="." method="_on_RestartButton_pressed"] [connection signal="pressed" from="RestartButton" to="." method="_on_RestartButton_pressed"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://Scenes/Scripts/Screen_Menu.gd" type="Script" id=1] [ext_resource path="res://Scenes/Scripts/Screen_Menu.gd" type="Script" id=1]
[ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=2] [ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=2]
@ -6,6 +6,8 @@
[ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=4] [ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=4]
[ext_resource path="res://Assets/tres_button/hover.tres" type="StyleBox" id=5] [ext_resource path="res://Assets/tres_button/hover.tres" type="StyleBox" id=5]
[ext_resource path="res://Assets/windows/window.png" type="Texture" id=6] [ext_resource path="res://Assets/windows/window.png" type="Texture" id=6]
[ext_resource path="res://Musics/wav/menu.wav" type="AudioStream" id=7]
[ext_resource path="res://Musics/sound effect/hower.wav" type="AudioStream" id=8]
[node name="Node2D" type="Node2D"] [node name="Node2D" type="Node2D"]
@ -23,16 +25,17 @@ margin_bottom = 392.0
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="VBoxContainer" type="VBoxContainer" parent="MenuButton"] [node name="VBoxContainer" type="VBoxContainer" parent="MenuButton"]
margin_left = -24.0 margin_left = -48.0
margin_top = 40.0 margin_top = 40.0
margin_right = 76.0 margin_right = 88.0
margin_bottom = 203.0 margin_bottom = 272.0
custom_constants/separation = 26 custom_constants/separation = 26
alignment = 1 alignment = 1
[node name="PlayButton" type="Button" parent="MenuButton/VBoxContainer"] [node name="PlayButton" type="Button" parent="MenuButton/VBoxContainer"]
margin_right = 100.0 margin_top = 34.0
margin_bottom = 37.0 margin_right = 136.0
margin_bottom = 71.0
custom_colors/font_color = Color( 1, 1, 1, 1 ) custom_colors/font_color = Color( 1, 1, 1, 1 )
custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 ) custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 )
custom_fonts/font = ExtResource( 2 ) custom_fonts/font = ExtResource( 2 )
@ -42,9 +45,9 @@ custom_styles/normal = ExtResource( 3 )
text = "PLAY" text = "PLAY"
[node name="Help_Button" type="Button" parent="MenuButton/VBoxContainer"] [node name="Help_Button" type="Button" parent="MenuButton/VBoxContainer"]
margin_top = 63.0 margin_top = 97.0
margin_right = 100.0 margin_right = 136.0
margin_bottom = 100.0 margin_bottom = 134.0
custom_colors/font_color = Color( 1, 1, 1, 1 ) custom_colors/font_color = Color( 1, 1, 1, 1 )
custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 ) custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 )
custom_fonts/font = ExtResource( 2 ) custom_fonts/font = ExtResource( 2 )
@ -54,9 +57,9 @@ custom_styles/normal = ExtResource( 3 )
text = "HELP" text = "HELP"
[node name="Quit_Button" type="Button" parent="MenuButton/VBoxContainer"] [node name="Quit_Button" type="Button" parent="MenuButton/VBoxContainer"]
margin_top = 126.0 margin_top = 160.0
margin_right = 100.0 margin_right = 136.0
margin_bottom = 163.0 margin_bottom = 197.0
custom_colors/font_color = Color( 1, 1, 1, 1 ) custom_colors/font_color = Color( 1, 1, 1, 1 )
custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 ) custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 )
custom_fonts/font = ExtResource( 2 ) custom_fonts/font = ExtResource( 2 )
@ -65,6 +68,16 @@ custom_styles/pressed = ExtResource( 4 )
custom_styles/normal = ExtResource( 3 ) custom_styles/normal = ExtResource( 3 )
text = "QUIT" text = "QUIT"
[node name="Hover" type="AudioStreamPlayer" parent="MenuButton"]
stream = ExtResource( 8 )
[node name="MenuMusic" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 7 )
autoplay = true
[connection signal="mouse_entered" from="MenuButton/VBoxContainer/PlayButton" to="MenuButton" method="_on_PlayButton_mouse_entered"]
[connection signal="pressed" from="MenuButton/VBoxContainer/PlayButton" to="MenuButton" method="_on_PlayButton_pressed"] [connection signal="pressed" from="MenuButton/VBoxContainer/PlayButton" to="MenuButton" method="_on_PlayButton_pressed"]
[connection signal="mouse_entered" from="MenuButton/VBoxContainer/Help_Button" to="MenuButton" method="_on_Help_Button_mouse_entered"]
[connection signal="pressed" from="MenuButton/VBoxContainer/Help_Button" to="MenuButton" method="_on_Help_Button_pressed"] [connection signal="pressed" from="MenuButton/VBoxContainer/Help_Button" to="MenuButton" method="_on_Help_Button_pressed"]
[connection signal="mouse_entered" from="MenuButton/VBoxContainer/Quit_Button" to="MenuButton" method="_on_Quit_Button_mouse_entered"]
[connection signal="pressed" from="MenuButton/VBoxContainer/Quit_Button" to="MenuButton" method="_on_Quit_Button_pressed"] [connection signal="pressed" from="MenuButton/VBoxContainer/Quit_Button" to="MenuButton" method="_on_Quit_Button_pressed"]