ADD: improve a little bit the GUI.
parent
9e8fbafaa8
commit
f27c52e8ea
|
@ -1,16 +1,11 @@
|
||||||
extends Area2D
|
extends Area2D
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
func _on_body_entered(body):
|
func _on_body_entered(body):
|
||||||
if body in get_tree().get_nodes_in_group('player'):
|
if body in get_tree().get_nodes_in_group('player'):
|
||||||
CheckPoint.add_checkpoint(name, body.global_position, Music.m_current)
|
CheckPoint.add_checkpoint(name, body.global_position, Music.m_current)
|
||||||
|
|
|
@ -3,6 +3,7 @@ extends CanvasLayer
|
||||||
var m_freq = 2
|
var m_freq = 2
|
||||||
var m_phase = 0.0
|
var m_phase = 0.0
|
||||||
var m_alarm_on = false
|
var m_alarm_on = false
|
||||||
|
var m_prev = 0
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
$ColorRect.visible = false
|
$ColorRect.visible = false
|
||||||
|
@ -14,7 +15,16 @@ func _process(delta):
|
||||||
var t = sin(2 * PI * m_phase)
|
var t = sin(2 * PI * m_phase)
|
||||||
m_phase += m_freq * delta
|
m_phase += m_freq * delta
|
||||||
$ColorRect.color = Color(1.0, 0.2, 0.2, (1.0 - t) * 0.0 + t * 0.1)
|
$ColorRect.color = Color(1.0, 0.2, 0.2, (1.0 - t) * 0.0 + t * 0.1)
|
||||||
if t >= 0.95:
|
var thres = 0.80
|
||||||
|
var cam : Camera2D = get_tree().get_nodes_in_group('camera')[0]
|
||||||
|
|
||||||
|
if t >= thres and m_prev < thres:
|
||||||
Music.play_sfx('piew')
|
Music.play_sfx('piew')
|
||||||
|
m_prev = t
|
||||||
|
|
||||||
|
var zoom = (1.0 - t) * 1.5 + t * 1.51
|
||||||
|
cam.zoom.x = zoom
|
||||||
|
cam.zoom.y = zoom
|
||||||
|
|
||||||
else:
|
else:
|
||||||
$ColorRect.visible = false
|
$ColorRect.visible = false
|
||||||
|
|
|
@ -35,12 +35,15 @@ func _on_area_2d_body_entered(_body):
|
||||||
CheckPoint.get_checkpoint().alarm = true
|
CheckPoint.get_checkpoint().alarm = true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _on_area_2d_more_body_entered(_body):
|
func _on_area_2d_more_body_entered(_body):
|
||||||
$Sandbox.strike_enabled = true
|
$Sandbox.strike_enabled = true
|
||||||
$Sandbox.m_strike_freq = 1.0
|
$Sandbox.m_strike_freq = 1
|
||||||
$CanvasTime.visible = true
|
$CanvasTime.visible = true
|
||||||
$EndTimer.start()
|
$EndTimer.start()
|
||||||
if CheckPoint.has_checkpoint():
|
if CheckPoint.has_checkpoint():
|
||||||
CheckPoint.get_checkpoint().strikes = true
|
CheckPoint.get_checkpoint().strikes = true
|
||||||
CheckPoint.get_checkpoint().alarm = true
|
CheckPoint.get_checkpoint().alarm = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_end_timer_timeout():
|
||||||
|
get_tree().change_scene_to_file("res://WinMenu/win_menu.tscn")
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -15,3 +15,7 @@ func _on_button_pressed():
|
||||||
func _on_checkpoint_pressed():
|
func _on_checkpoint_pressed():
|
||||||
get_tree().change_scene_to_file("res://Levels/level_intro.tscn")
|
get_tree().change_scene_to_file("res://Levels/level_intro.tscn")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_quit_btn_pressed():
|
||||||
|
get_tree().quit()
|
||||||
|
|
|
@ -20,29 +20,40 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
color = Color(0, 0, 0, 1)
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 1
|
||||||
offset_left = 473.0
|
anchors_preset = 8
|
||||||
offset_top = 54.0
|
anchor_left = 0.5
|
||||||
offset_right = 551.0
|
anchor_top = 0.5
|
||||||
offset_bottom = 77.0
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -130.0
|
||||||
|
offset_top = -147.0
|
||||||
|
offset_right = 136.0
|
||||||
|
offset_bottom = 160.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
text = "YOU LOSE"
|
text = "YOU LOSE"
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="."]
|
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
|
||||||
layout_mode = 0
|
layout_mode = 2
|
||||||
offset_left = 499.0
|
|
||||||
offset_top = 192.0
|
[node name="Checkpoint" type="Button" parent="VBoxContainer"]
|
||||||
offset_right = 555.0
|
layout_mode = 2
|
||||||
offset_bottom = 223.0
|
|
||||||
text = "RETRY"
|
text = "RETRY"
|
||||||
|
|
||||||
[node name="Checkpoint" type="Button" parent="."]
|
[node name="Button" type="Button" parent="VBoxContainer"]
|
||||||
layout_mode = 0
|
layout_mode = 2
|
||||||
offset_left = 468.0
|
text = "RESTART"
|
||||||
offset_top = 131.0
|
|
||||||
offset_right = 598.0
|
|
||||||
offset_bottom = 162.0
|
|
||||||
text = "Last checkpoint"
|
|
||||||
|
|
||||||
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
[node name="QuitBtn" type="Button" parent="VBoxContainer"]
|
||||||
[connection signal="pressed" from="Checkpoint" to="." method="_on_checkpoint_pressed"]
|
layout_mode = 2
|
||||||
|
text = "QUIT"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="VBoxContainer/Checkpoint" to="." method="_on_checkpoint_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/Button" to="." method="_on_button_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/QuitBtn" to="." method="_on_quit_btn_pressed"]
|
||||||
|
|
|
@ -8,6 +8,9 @@ func _ready():
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
func _on_play_btn_pressed():
|
||||||
func _on_button_pressed():
|
|
||||||
get_tree().change_scene_to_file("res://Levels/level_intro.tscn")
|
get_tree().change_scene_to_file("res://Levels/level_intro.tscn")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_quit_btn_pressed():
|
||||||
|
get_tree().quit()
|
||||||
|
|
|
@ -11,13 +11,45 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
script = ExtResource("1_ga0yx")
|
script = ExtResource("1_ga0yx")
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="."]
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 1
|
||||||
offset_left = 518.0
|
anchors_preset = 15
|
||||||
offset_top = 184.0
|
anchor_right = 1.0
|
||||||
offset_right = 565.0
|
anchor_bottom = 1.0
|
||||||
offset_bottom = 215.0
|
grow_horizontal = 2
|
||||||
text = "PLAY
|
grow_vertical = 2
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -109.0
|
||||||
|
offset_top = -75.0
|
||||||
|
offset_right = 108.0
|
||||||
|
offset_bottom = 129.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
text = "Ludum Dare 54"
|
||||||
|
|
||||||
|
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="PlayBtn" type="Button" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Play
|
||||||
"
|
"
|
||||||
|
|
||||||
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
[node name="QuitBtn" type="Button" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Quit"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="VBoxContainer/PlayBtn" to="." method="_on_play_btn_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/QuitBtn" to="." method="_on_quit_btn_pressed"]
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
[gd_scene load_steps=3 format=3 uid="uid://82kxvlr252x4"]
|
[gd_scene load_steps=4 format=3 uid="uid://82kxvlr252x4"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://MsgBox/msg_box.gd" id="1_5d2k7"]
|
[ext_resource type="Script" path="res://MsgBox/msg_box.gd" id="1_5d2k7"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_msojn"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_msojn"]
|
||||||
|
bg_color = Color(0.00784314, 0.458824, 0.396078, 1)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rpitp"]
|
||||||
|
bg_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="MsgBox" type="Control"]
|
[node name="MsgBox" type="Control"]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
|
@ -40,18 +44,25 @@ grow_vertical = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="Panel/VBoxContainer"]
|
[node name="Label" type="Label" parent="Panel/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
theme_override_styles/normal = SubResource("StyleBoxFlat_rpitp")
|
||||||
text = "TITRE"
|
text = "TITRE"
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
|
|
||||||
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer"]
|
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
theme_override_colors/default_color = Color(0, 0, 0, 1)
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
text = "text"
|
text = "text"
|
||||||
fit_content = true
|
fit_content = true
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="Panel/VBoxContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
alignment = 2
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="Panel/VBoxContainer/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 8
|
size_flags_vertical = 8
|
||||||
text = "OK"
|
text = "OK"
|
||||||
|
|
||||||
[connection signal="pressed" from="Panel/VBoxContainer/Button" to="." method="_on_button_pressed"]
|
[connection signal="pressed" from="Panel/VBoxContainer/VBoxContainer/Button" to="." method="_on_button_pressed"]
|
||||||
|
|
|
@ -7,17 +7,16 @@ var m_stop_timer = 0.0
|
||||||
var m_stop_time = 0.5
|
var m_stop_time = 0.5
|
||||||
var m_stop = false
|
var m_stop = false
|
||||||
var m_next = null
|
var m_next = null
|
||||||
var m_sfx_player : AudioStreamPlayer = null
|
var m_sfx_players : Array = []
|
||||||
var m_titles = [
|
var m_titles = [
|
||||||
'fight_or_die'
|
'fight_or_die'
|
||||||
]
|
]
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
m_player = AudioStreamPlayer.new()
|
m_player = AudioStreamPlayer.new()
|
||||||
m_sfx_player = AudioStreamPlayer.new()
|
|
||||||
m_player.process_mode = Node.PROCESS_MODE_ALWAYS
|
m_player.process_mode = Node.PROCESS_MODE_ALWAYS
|
||||||
add_child(m_player)
|
add_child(m_player)
|
||||||
add_child(m_sfx_player)
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if m_stop:
|
if m_stop:
|
||||||
|
@ -42,7 +41,7 @@ func next(music_name):
|
||||||
play(music_name)
|
play(music_name)
|
||||||
|
|
||||||
func play(music_name):
|
func play(music_name):
|
||||||
m_player.volume_db = -7.0
|
m_player.volume_db = -10.0
|
||||||
m_current = music_name
|
m_current = music_name
|
||||||
var data = load("res://Music/" + music_name + ".ogg")
|
var data = load("res://Music/" + music_name + ".ogg")
|
||||||
data.loop = true
|
data.loop = true
|
||||||
|
@ -51,8 +50,15 @@ func play(music_name):
|
||||||
m_player.play()
|
m_player.play()
|
||||||
|
|
||||||
func play_sfx(sfx_name):
|
func play_sfx(sfx_name):
|
||||||
m_sfx_player.stream = load("res://Music/" + sfx_name + ".wav")
|
var player : AudioStreamPlayer = AudioStreamPlayer.new()
|
||||||
m_sfx_player.play()
|
player.stream = load("res://Music/" + sfx_name + ".wav")
|
||||||
m_sfx_player.volume_db = 5
|
player.volume_db = -10
|
||||||
|
player.connect("finished", _sfx_end)
|
||||||
|
add_child(player)
|
||||||
|
m_sfx_players.push_back(player)
|
||||||
|
player.play()
|
||||||
|
|
||||||
|
func _sfx_end():
|
||||||
|
m_sfx_players = m_sfx_players.filter(func (x): return x.playing)
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -6,7 +6,6 @@ var m_shoot_timer = 0.0
|
||||||
|
|
||||||
func _physics_process(dt):
|
func _physics_process(dt):
|
||||||
var delta = Vector2(0, 0)
|
var delta = Vector2(0, 0)
|
||||||
|
|
||||||
if Input.is_action_just_pressed("player_jump") and $Actor.is_normal():
|
if Input.is_action_just_pressed("player_jump") and $Actor.is_normal():
|
||||||
$Actor.to_jump()
|
$Actor.to_jump()
|
||||||
|
|
||||||
|
|
|
@ -8,5 +8,6 @@ script = ExtResource("1_2pfvx")
|
||||||
|
|
||||||
[node name="Actor" parent="." instance=ExtResource("2_s40rr")]
|
[node name="Actor" parent="." instance=ExtResource("2_s40rr")]
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="Actor"]
|
[node name="Camera2D" type="Camera2D" parent="Actor" groups=["camera"]]
|
||||||
|
ignore_rotation = false
|
||||||
zoom = Vector2(1.5, 1.5)
|
zoom = Vector2(1.5, 1.5)
|
||||||
|
|
|
@ -48,6 +48,8 @@ func process(delta):
|
||||||
break
|
break
|
||||||
if ground:
|
if ground:
|
||||||
Music.play_sfx('strike')
|
Music.play_sfx('strike')
|
||||||
|
var cam = get_tree().get_nodes_in_group('camera')[0]
|
||||||
|
cam.rotation = randf_range(-PI/25.0, PI/25.0)
|
||||||
self.add_broken_ground(ground, 1, 0.8)
|
self.add_broken_ground(ground, 1, 0.8)
|
||||||
$Strikes.add_line(to_global($TileMap.map_to_local(ground)), 0.15)
|
$Strikes.add_line(to_global($TileMap.map_to_local(ground)), 0.15)
|
||||||
m_strike_timer = 0.0
|
m_strike_timer = 0.0
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_main_menu_btn_pressed():
|
||||||
|
get_tree().change_scene_to_file("res://MainMenu/main_menu.tscn")
|
||||||
|
|
||||||
|
func _on_restart_btn_pressed():
|
||||||
|
get_tree().change_scene_to_file("res://Levels/level_intro.tscn")
|
||||||
|
|
||||||
|
func _on_quit_btn_pressed():
|
||||||
|
get_tree().quit()
|
|
@ -0,0 +1,59 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://bhkf4qcibdpkv"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://WinMenu/win_menu.gd" id="1_litpr"]
|
||||||
|
|
||||||
|
[node name="WinMenu" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_litpr")
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
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="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -37.5
|
||||||
|
offset_top = -20.0
|
||||||
|
offset_right = 37.5
|
||||||
|
offset_bottom = 20.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
text = "VICTORY !"
|
||||||
|
|
||||||
|
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="MainMenuBtn" type="Button" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Back to main menu"
|
||||||
|
|
||||||
|
[node name="RestartBtn" type="Button" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Restart"
|
||||||
|
|
||||||
|
[node name="QuitBtn" type="Button" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Quit"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="VBoxContainer/MainMenuBtn" to="." method="_on_main_menu_btn_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/RestartBtn" to="." method="_on_restart_btn_pressed"]
|
||||||
|
[connection signal="pressed" from="VBoxContainer/QuitBtn" to="." method="_on_quit_btn_pressed"]
|
Loading…
Reference in New Issue