Add a way to skip turns
This commit is contained in:
parent
399ab622a2
commit
23f8070ac1
8
TODO.md
8
TODO.md
|
@ -11,9 +11,9 @@
|
|||
3. Sound effects
|
||||
* on hit
|
||||
* if possible, a small bit of background music
|
||||
4. Further visual polish
|
||||
5. New units
|
||||
4. New units
|
||||
5. Further visual polish
|
||||
|
||||
Bugs
|
||||
Bugs of note:
|
||||
|
||||
* if the player has no possible moves, there is no way to continue: add a skip turn button
|
||||
* n/a
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
Binary file not shown.
16
src/Game.gd
16
src/Game.gd
|
@ -258,10 +258,12 @@ func _ready():
|
|||
func _input(ev):
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
print(ev)
|
||||
self._on_escape()
|
||||
self._on_escape(false, "Paused")
|
||||
|
||||
func _on_escape(force_visible = false):
|
||||
func _on_escape(force_visible = false, message = null):
|
||||
var n = get_node("/root/Game/EndMenu")
|
||||
if message != null:
|
||||
n.get_node("VBoxContainer/Label").set_text(message)
|
||||
if n.is_visible() and not force_visible:
|
||||
n.set_visible(false)
|
||||
else:
|
||||
|
@ -336,6 +338,10 @@ func _on_phase_end():
|
|||
if not self.current_state in self.states.keys():
|
||||
self.current_state = 0
|
||||
self._on_new_turn()
|
||||
if self.current_state == 0:
|
||||
get_node("PanelRight/VBox/HBox/VBox/HBox/SkipTurnButton").set_disabled(false)
|
||||
else:
|
||||
get_node("PanelRight/VBox/HBox/VBox/HBox/SkipTurnButton").set_disabled(true)
|
||||
get_node("TopBar/Bottom/Instruction").set_text(
|
||||
self.states[self.current_state]["description"] + " - " + self.states[self.current_state]["directive"]
|
||||
)
|
||||
|
@ -455,7 +461,7 @@ func _process(delta):
|
|||
get_node("/root/Game/BottomBar/Help").set_text("Well, I'll be damned. I didn't think this would happen!")
|
||||
get_node("/root/Game/Impossible").play()
|
||||
# Show a popup for new one, or quit
|
||||
self._on_escape(true)
|
||||
self._on_escape(true, "Game over!")
|
||||
if self.current_state == 1:
|
||||
if self.ai_target != null:
|
||||
var target_square = self.board_squares[self.ai_target]
|
||||
|
@ -608,3 +614,7 @@ func _on_Huh_finished():
|
|||
|
||||
func _on_StopThat_finished():
|
||||
get_node("/root/Game/StopThat").stop()
|
||||
|
||||
|
||||
func _on_SkipTurnButton_pressed():
|
||||
self._on_phase_end()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=15 format=2]
|
||||
[gd_scene load_steps=20 format=2]
|
||||
|
||||
[ext_resource path="res://src/Game.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/Playfield.tscn" type="PackedScene" id=2]
|
||||
|
@ -13,11 +13,18 @@
|
|||
[ext_resource path="res://assets/export/huh.wav" type="AudioStream" id=11]
|
||||
[ext_resource path="res://assets/export/dust.wav" type="AudioStream" id=12]
|
||||
[ext_resource path="res://assets/export/hehe.wav" type="AudioStream" id=13]
|
||||
[ext_resource path="res://assets/export/skip.png" type="Texture" id=14]
|
||||
[ext_resource path="res://assets/export/skip_pressed.png" type="Texture" id=15]
|
||||
[ext_resource path="res://assets/export/skip_disabled.png" type="Texture" id=16]
|
||||
[ext_resource path="res://assets/export/skip_hover.png" type="Texture" id=17]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 24
|
||||
font_data = ExtResource( 4 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
font_data = ExtResource( 4 )
|
||||
|
||||
[node name="Game" type="Container"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
@ -105,7 +112,6 @@ text = "Do a thing"
|
|||
valign = 1
|
||||
|
||||
[node name="EndMenu" parent="." instance=ExtResource( 5 )]
|
||||
visible = true
|
||||
|
||||
[node name="EndSong" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 6 )
|
||||
|
@ -132,6 +138,58 @@ stream = ExtResource( 11 )
|
|||
|
||||
[node name="StopThat" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 10 )
|
||||
|
||||
[node name="PanelRight" type="Panel" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 1024.0
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="PanelRight"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 15.0
|
||||
margin_top = 15.0
|
||||
margin_right = -15.0
|
||||
margin_bottom = -15.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="PanelRight/VBox"]
|
||||
margin_right = 226.0
|
||||
margin_bottom = 87.0
|
||||
alignment = 2
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="PanelRight/VBox/HBox"]
|
||||
margin_left = 136.0
|
||||
margin_right = 226.0
|
||||
margin_bottom = 87.0
|
||||
alignment = 1
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="PanelRight/VBox/HBox/VBox"]
|
||||
margin_right = 90.0
|
||||
margin_bottom = 64.0
|
||||
alignment = 1
|
||||
|
||||
[node name="SkipTurnButton" type="TextureButton" parent="PanelRight/VBox/HBox/VBox/HBox"]
|
||||
margin_left = 13.0
|
||||
margin_right = 77.0
|
||||
margin_bottom = 64.0
|
||||
hint_tooltip = "Skip Turn"
|
||||
texture_normal = ExtResource( 14 )
|
||||
texture_pressed = ExtResource( 15 )
|
||||
texture_hover = ExtResource( 17 )
|
||||
texture_disabled = ExtResource( 16 )
|
||||
stretch_mode = 3
|
||||
|
||||
[node name="Label" type="Label" parent="PanelRight/VBox/HBox/VBox"]
|
||||
margin_top = 68.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 87.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
text = "Skip Turn"
|
||||
align = 1
|
||||
valign = 1
|
||||
[connection signal="finished" from="EndSong" to="." method="_on_EndSong_finished"]
|
||||
[connection signal="finished" from="Yammering" to="." method="_on_Yammering_finished"]
|
||||
[connection signal="finished" from="Dust" to="." method="_on_Dust_finished"]
|
||||
|
@ -140,3 +198,4 @@ stream = ExtResource( 10 )
|
|||
[connection signal="finished" from="Hehe" to="." method="_on_Hehe_finished"]
|
||||
[connection signal="finished" from="Huh" to="." method="_on_Huh_finished"]
|
||||
[connection signal="finished" from="StopThat" to="." method="_on_StopThat_finished"]
|
||||
[connection signal="pressed" from="PanelRight/VBox/HBox/VBox/HBox/SkipTurnButton" to="." method="_on_SkipTurnButton_pressed"]
|
||||
|
|
Loading…
Reference in New Issue