-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from OpMonTeam/30-in-game-menu
Added game menu
- Loading branch information
Showing
8 changed files
with
230 additions
and
17 deletions.
There are no files selected for viewing
Submodule OpMon-Data
updated
3 files
+6 −0 | translations.csv | |
+ − | translations.en.translation | |
+ − | translations.fr.translation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
extends Interface | ||
|
||
var labels := [] | ||
|
||
var selection := 0 | ||
|
||
signal choice(id) | ||
|
||
func _ready(): | ||
labels.append($OpMonLabel) | ||
labels.append($BagLabel) | ||
labels.append($OpDexLabel) | ||
labels.append($IDLabel) | ||
labels.append($SaveLabel) | ||
labels.append($SettingsLabel) | ||
self.rect_position = (Vector2(960,640) / 2) - (self.rect_size / 2) | ||
|
||
func _input(event): | ||
# Conditions on selection are here to avoid warping | ||
if event.is_action_pressed("ui_accept"): | ||
emit_signal("choice", selection) | ||
emit_signal("closed") | ||
elif event.is_action_pressed("menu"): | ||
emit_signal("closed") | ||
elif event.is_action_pressed("ui_down") and selection != 4: | ||
selection += 2 | ||
elif event.is_action_pressed("ui_up") and selection != 1: | ||
selection -= 2 | ||
elif event.is_action_pressed("ui_left") and selection % 2 == 1: | ||
selection -= 1 | ||
elif event.is_action_pressed("ui_right") and selection % 2 == 0: | ||
selection += 1 | ||
if selection < 0: | ||
selection = 0 | ||
elif selection > 5: | ||
selection = 5 | ||
$ChoiceRect.rect_position = labels[selection].rect_position |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
[gd_scene load_steps=4 format=2] | ||
|
||
[ext_resource path="res://Scenes/GameMenu/GameMenu.gd" type="Script" id=1] | ||
|
||
[sub_resource type="DynamicFontData" id=1] | ||
font_path = "res://OpMon-Data/Fonts/main_font.ttf" | ||
|
||
[sub_resource type="DynamicFont" id=2] | ||
size = 23 | ||
font_data = SubResource( 1 ) | ||
|
||
[node name="GameMenu" type="Control"] | ||
anchor_right = 0.417 | ||
anchor_bottom = 0.625 | ||
margin_right = -0.320038 | ||
script = ExtResource( 1 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="Background" type="ColorRect" parent="."] | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
color = Color( 0.533333, 0.533333, 0.533333, 1 ) | ||
__meta__ = { | ||
"_edit_use_anchors_": false, | ||
"_editor_description_": "" | ||
} | ||
|
||
[node name="OpMonLabel" type="Label" parent="."] | ||
margin_left = 8.0 | ||
margin_top = 8.0 | ||
margin_right = 192.0 | ||
margin_bottom = 136.0 | ||
custom_fonts/font = SubResource( 2 ) | ||
text = "GAMEMENU_OPMON" | ||
align = 1 | ||
valign = 1 | ||
clip_text = true | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="BagLabel" type="Label" parent="."] | ||
margin_left = 208.0 | ||
margin_top = 8.0 | ||
margin_right = 392.0 | ||
margin_bottom = 136.0 | ||
custom_fonts/font = SubResource( 2 ) | ||
text = "GAMEMENU_BAG" | ||
align = 1 | ||
valign = 1 | ||
clip_text = true | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="OpDexLabel" type="Label" parent="."] | ||
margin_left = 8.0 | ||
margin_top = 144.0 | ||
margin_right = 192.0 | ||
margin_bottom = 269.0 | ||
custom_fonts/font = SubResource( 2 ) | ||
text = "GAMEMENU_ENCYCLOPEDIA" | ||
align = 1 | ||
valign = 1 | ||
clip_text = true | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="IDLabel" type="Label" parent="."] | ||
margin_left = 208.0 | ||
margin_top = 144.0 | ||
margin_right = 392.0 | ||
margin_bottom = 269.0 | ||
custom_fonts/font = SubResource( 2 ) | ||
text = "GAMEMENU_ID" | ||
align = 1 | ||
valign = 1 | ||
clip_text = true | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="SaveLabel" type="Label" parent="."] | ||
margin_left = 8.0 | ||
margin_top = 269.0 | ||
margin_right = 192.0 | ||
margin_bottom = 394.0 | ||
custom_fonts/font = SubResource( 2 ) | ||
text = "GAMEMENU_SAVE" | ||
align = 1 | ||
valign = 1 | ||
clip_text = true | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="SettingsLabel" type="Label" parent="."] | ||
margin_left = 208.0 | ||
margin_top = 269.0 | ||
margin_right = 392.0 | ||
margin_bottom = 394.0 | ||
custom_fonts/font = SubResource( 2 ) | ||
text = "GAMEMENU_SETTINGS" | ||
align = 1 | ||
valign = 1 | ||
clip_text = true | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="ChoiceRect" type="ColorRect" parent="."] | ||
margin_left = 8.0 | ||
margin_top = 8.0 | ||
margin_right = 192.0 | ||
margin_bottom = 136.0 | ||
color = Color( 1, 1, 1, 0.45098 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters