Skip to content

Commit 32c5039

Browse files
authored
Complete
Feature/005 main menu
2 parents 4db92f1 + df1f2c8 commit 32c5039

16 files changed

+209
-63
lines changed

icon.png

-1.15 KB
Loading

tools/backpack/backpack.gd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const COLLECTION_TEXT = [
2323
]
2424

2525
var _items: Array = Array()
26-
var _slots: int = 20
26+
var _slots: int = 12
2727

2828
func _ready() -> void:
2929
_display_status("Hey from root")
@@ -76,15 +76,16 @@ func add_item(new_item: Item) -> void:
7676
func remove_item(item: Item) -> void:
7777
_items.erase(item)
7878

79-
func _drop_item(item: Item) -> void:
79+
func _drop_item(item: Item, display_message: bool = true) -> void:
8080
if item.get_parent():
8181
item.get_parent().remove_child(item)
8282

8383
item.set_visible(true)
8484
item.set_position(get_global_transform().get_origin())
8585
GameData.world.add_entity(item)
8686

87-
_display_status("I dropped a thingy")
87+
if (display_message):
88+
_display_status("I dropped a thingy")
8889

8990
func update_mood_display() -> void:
9091
GameData.ingame_menu.find_node("tool_status_display").find_node("backpack").set_mood(mood)

tools/backpack/hungry_backpack.gd

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const DONT_PICKUP_ITEM_MESSAGE = [
2424
var _since_last_feed: float = 0.0
2525
var _hungry_state: int = 0
2626
var _pickup_blacklist: Array = []
27+
var _mood_modus = 4
2728

2829
func _ready() -> void:
2930
pass
@@ -41,7 +42,7 @@ func give_item_by_id(item_id: String):
4142
ItemInfo.WATER_BOTTLE_ID:
4243
_display_status("It's just water -.-")
4344
_change_mood(5.0)
44-
_since_last_feed = 0.0
45+
_since_last_feed += 5.0
4546
ItemInfo.FISH_ID:
4647
_display_status("Uhh un fish, thank you, it will keep me fed")
4748
_change_mood(15.0)
@@ -62,27 +63,27 @@ func _process(delta: float) -> void:
6263
_since_last_feed += delta
6364

6465
# Food status
65-
if _since_last_feed < 30:
66+
if _since_last_feed < 10:
6667
_hungry_state = 0
6768
_change_mood(0.5 * delta)
68-
elif _since_last_feed < 60:
69+
elif _since_last_feed < 30:
6970
if (_hungry_state == 0):
7071
_display_hungry_stage_message(1)
7172

7273
_hungry_state = 1
73-
_change_mood(0.0 * delta)
74-
elif _since_last_feed < 90:
74+
_change_mood(-1.0 * delta)
75+
elif _since_last_feed < 45:
7576
if (_hungry_state == 1):
7677
_display_hungry_stage_message(2)
7778

7879
_hungry_state = 2
79-
_change_mood(-1.0 * delta)
80+
_change_mood(-2.0 * delta)
8081
else:
8182
if (_hungry_state == 2):
8283
_display_hungry_stage_message(3)
8384

8485
_hungry_state = 3
85-
_change_mood(-3.0 * delta)
86+
_change_mood(-5.0 * delta)
8687

8788
func _display_hungry_stage_message(stage: int) -> void:
8889
var messages = HUNGRY_STATE_CHANGE_MESSAGES[stage]
@@ -112,29 +113,35 @@ func _change_mood(change: float):
112113
._change_mood(change)
113114

114115
var mood = get_mood()
115-
if (mood > 90.0):
116-
if (last_mood < 75.0):
117-
_change_slots(20)
118-
_pickup_blacklist.clear()
119-
elif (mood > 75.0):
120-
if (last_mood > 90.0 || last_mood < 50.0):
121-
_change_slots(12)
122-
123-
if (last_mood < 50.0):
124-
_pickup_blacklist = _pickup_blacklist.slice(0, _pickup_blacklist.size(), 2)
125-
126-
elif (mood > 50.0):
127-
if (last_mood > 75.0 || last_mood < 25.0):
128-
_change_slots(6)
116+
117+
if (mood < 25.0):
118+
if (_mood_modus != 0):
119+
_mood_modus = 0
120+
_change_slots(3)
129121
_drop_random_stack()
130122

131-
if (last_mood < 25.0):
123+
elif (mood < 50.0):
124+
if (_mood_modus == 2):
132125
_pickup_blacklist = _pickup_blacklist.slice(0, _pickup_blacklist.size(), 3)
133-
134-
elif (mood > 25.0):
135-
if (last_mood > 50.0):
136-
_change_slots(3)
126+
127+
if (_mood_modus != 1):
128+
_mood_modus = 1
129+
_change_slots(4)
137130
_drop_random_stack()
131+
132+
elif (mood < 75.0):
133+
if (_mood_modus == 4):
134+
_pickup_blacklist = _pickup_blacklist.slice(0, _pickup_blacklist.size(), 2)
135+
136+
if (_mood_modus != 3):
137+
_mood_modus = 3
138+
_change_slots(6)
139+
140+
elif (mood < 90.0):
141+
if (_mood_modus != 4):
142+
_mood_modus = 4
143+
_change_slots(7)
144+
_pickup_blacklist.clear()
138145

139146
func _change_slots(new_slot_count: int) -> void:
140147
_display_change_slot_count_message(1 if ((_slots - new_slot_count) > 1) else 0)
@@ -144,6 +151,8 @@ func _change_slots(new_slot_count: int) -> void:
144151
var drop_count = min(0, _items.size() - _slots)
145152
for index in range(drop_count):
146153
_drop_random_stack()
154+
155+
GameData.ingame_menu.get_node("backpack_ui").gen_slots()
147156

148157
func _display_change_slot_count_message(change_type: int) -> void:
149158
var messages = SLOT_COUNT_CHANGE_MESSAGE[change_type]
@@ -158,4 +167,4 @@ func _drop_random_stack() -> void:
158167
var item = _items[index]
159168

160169
.remove_item(item)
161-
._drop_item(item)
170+
._drop_item(item, true)

tools/boots/dunk_boots.gd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ func get_movement(delta: float) -> Vector2:
6262
0, 1:
6363
return (input_motion * speed) + (drunk_motion * DRUNK_MOTION_SPEED * delta * 0.5)
6464
2:
65-
var rot = sin(self.delta * 10) * randf() * 0.5
66-
return (input_motion.rotated(rot) * speed) + (drunk_motion * DRUNK_MOTION_SPEED * delta * 0.5)
65+
var rot = sin(self.delta * 10) * randf() * 1
66+
return (input_motion.rotated(rot) * speed) + (drunk_motion * DRUNK_MOTION_SPEED * delta * 0.75)
6767
3:
68-
var rot = sin(self.delta * 10) * randf() * 1.5
68+
var rot = sin(self.delta * 10) * randf() * 2.5
6969
return (input_motion.rotated(rot) * speed) + (drunk_motion * DRUNK_MOTION_SPEED * delta)
7070
4:
71-
var rot = sin(self.delta * 10) * randf() * 2
71+
var rot = sin(self.delta * 10) * randf() * 4
7272
return (input_motion.rotated(rot) * speed * 0.75) + (drunk_motion * DRUNK_MOTION_SPEED * delta * speed * 0.2)
7373

7474
return Vector2()
@@ -137,7 +137,7 @@ func _gen_drunk_motion() -> void:
137137
var rot = sin(self.delta * 75)
138138
drunk_motion = Vector2(10 * rot, 0)
139139
2:
140-
drunk_motion = Vector2()
140+
drunk_motion = Vector2(randf(), randf())
141141
3, 4:
142142
var b = 0
143143
match drunk_level:

ui/ingame/ingame_ui.tscn

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
[gd_scene load_steps=4 format=2]
1+
[gd_scene load_steps=6 format=2]
22

33
[ext_resource path="res://ui/ingame/ingame_ui.gd" type="Script" id=1]
44
[ext_resource path="res://ui/ingame/tool_status_display.tscn" type="PackedScene" id=2]
55
[ext_resource path="res://ui/ingame/inventory/backpack_ui.tscn" type="PackedScene" id=3]
6+
[ext_resource path="res://tools/boots/boots.png" type="Texture" id=4]
7+
[ext_resource path="res://tools/backpack/backpack.png" type="Texture" id=5]
68

79
[node name="control" type="Control"]
810
anchor_right = 1.0
@@ -77,6 +79,7 @@ anchor_top = 0.0
7779
anchor_bottom = 0.0
7880
margin_top = 0.0
7981
margin_bottom = 64.0
82+
texture = ExtResource( 4 )
8083

8184
[node name="weapon" parent="tool_status_display" instance=ExtResource( 2 )]
8285
visible = false
@@ -90,6 +93,7 @@ anchor_top = 0.0
9093
anchor_bottom = 0.0
9194
margin_top = 68.0
9295
margin_bottom = 132.0
96+
texture = ExtResource( 5 )
9397

9498
[node name="backpack_ui" parent="." instance=ExtResource( 3 )]
9599
anchor_left = 0.5

ui/ingame/tool_status_display.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
extends Control
22

3+
export var texture: Texture = null
4+
35
func _ready() -> void:
6+
$texture.set_texture(texture)
47
set_status("Hello World")
58
set_mood(75)
69
pass

ui/intro/info_text.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const INTRO_TEXT = [
1010
"So let's get to it. You can find a pice of scrap in each cardinal direction, they should be reachable by following the paths.",
1111
"",
1212
"Wait before you start, we have a slight problem... Most of our equipment got destroyed. You will get our special tools:",
13-
"Karl: These boots control your movement, but I have to warn you. He might have a slight alcohol addiction. Just keep him happy and sover enough to walk and you should be finde.",
14-
"Frank: The hungry backpack, he is a trusty companian, if you keep him well fed.",
13+
"These boots control your movement, but I have to warn you. He might have a slight alcohol addiction. Just keep him happy and sover enough to walk and you should be finde.",
14+
"The hungry backpack, he is a trusty companian, if you keep him well fed.",
1515
"Now you should start your adventure. Come to me, when you have colleced the four scrab pieces"
1616
]
1717

ui/intro/intro.tscn

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
[gd_scene load_steps=3 format=2]
1+
[gd_scene load_steps=4 format=2]
22

33
[ext_resource path="res://ui/intro/texti.png" type="Texture" id=1]
44
[ext_resource path="res://ui/intro/info_text.gd" type="Script" id=2]
5+
[ext_resource path="res://ui/main_menu/controlls.png" type="Texture" id=3]
56

67
[node name="intro" type="Control"]
78
anchor_right = 1.0
@@ -35,6 +36,20 @@ __meta__ = {
3536
[node name="into_text_timer" type="Timer" parent="info_text"]
3637
autostart = true
3738

39+
[node name="controls" type="TextureRect" parent="info_text"]
40+
anchor_left = 1.0
41+
anchor_top = 1.0
42+
anchor_right = 1.0
43+
anchor_bottom = 1.0
44+
margin_left = -288.0
45+
margin_top = -160.0
46+
texture = ExtResource( 3 )
47+
expand = true
48+
stretch_mode = 5
49+
__meta__ = {
50+
"_edit_use_anchors_": false
51+
}
52+
3853
[node name="skip_button" type="Button" parent="info_text"]
3954
anchor_left = 1.0
4055
anchor_top = 1.0

ui/main_menu/background.png

74.7 KB
Loading

ui/main_menu/controlls.png

296 KB
Loading

ui/main_menu/controlls.png.import

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="StreamTexture"
5+
path="res://.import/controlls.png-0f1b0e92761a0d6ed7c45a2b58477058.stex"
6+
metadata={
7+
"vram_texture": false
8+
}
9+
10+
[deps]
11+
12+
source_file="res://ui/main_menu/controlls.png"
13+
dest_files=[ "res://.import/controlls.png-0f1b0e92761a0d6ed7c45a2b58477058.stex" ]
14+
15+
[params]
16+
17+
compress/mode=0
18+
compress/lossy_quality=0.7
19+
compress/hdr_mode=0
20+
compress/bptc_ldr=0
21+
compress/normal_map=0
22+
flags/repeat=0
23+
flags/filter=true
24+
flags/mipmaps=false
25+
flags/anisotropic=false
26+
flags/srgb=2
27+
process/fix_alpha_border=true
28+
process/premult_alpha=false
29+
process/HDR_as_SRGB=false
30+
process/invert_color=false
31+
stream=false
32+
size_limit=0
33+
detect_3d=true
34+
svg/scale=1.0

ui/main_menu/main_menu.tscn

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
[gd_scene load_steps=3 format=2]
1+
[gd_scene load_steps=4 format=2]
22

33
[ext_resource path="res://ui/main_menu/background.png" type="Texture" id=1]
44
[ext_resource path="res://ui/main_menu/main_menu.gd" type="Script" id=2]
5+
[ext_resource path="res://ui/main_menu/name.png" type="Texture" id=3]
56

67
[node name="main_menu" type="Control"]
78
anchor_right = 1.0
@@ -26,31 +27,80 @@ anchor_left = 0.5
2627
anchor_top = 0.5
2728
anchor_right = 0.5
2829
anchor_bottom = 0.5
29-
margin_left = -100.0
30-
margin_top = -50.0
31-
margin_right = 100.0
32-
margin_bottom = 50.0
30+
margin_left = -114.5
31+
margin_top = -112.5
32+
margin_right = 114.5
33+
margin_bottom = 112.5
3334
__meta__ = {
3435
"_edit_use_anchors_": false
3536
}
3637

38+
[node name="name" type="TextureRect" parent="button_container"]
39+
margin_right = 229.0
40+
margin_bottom = 157.0
41+
texture = ExtResource( 3 )
42+
3743
[node name="start" type="Button" parent="button_container"]
38-
margin_right = 200.0
39-
margin_bottom = 30.0
44+
margin_top = 161.0
45+
margin_right = 229.0
46+
margin_bottom = 191.0
4047
rect_min_size = Vector2( 0, 30 )
4148
text = "Start"
4249
__meta__ = {
4350
"_edit_use_anchors_": false
4451
}
4552

4653
[node name="exit" type="Button" parent="button_container"]
47-
margin_top = 34.0
48-
margin_right = 200.0
49-
margin_bottom = 64.0
54+
margin_top = 195.0
55+
margin_right = 229.0
56+
margin_bottom = 225.0
5057
rect_min_size = Vector2( 0, 30 )
5158
text = "Exit"
5259
__meta__ = {
5360
"_edit_use_anchors_": false
5461
}
62+
63+
[node name="name_label" type="Label" parent="."]
64+
margin_right = 106.0
65+
margin_bottom = 37.0
66+
rect_min_size = Vector2( 120, 40 )
67+
text = "Made by
68+
xFrednet & Leit2"
69+
70+
[node name="backgound" type="ColorRect" parent="name_label"]
71+
show_behind_parent = true
72+
anchor_right = 1.0
73+
anchor_bottom = 1.0
74+
rect_min_size = Vector2( 120, 40 )
75+
color = Color( 0.254902, 0.294118, 0.596078, 1 )
76+
__meta__ = {
77+
"_edit_use_anchors_": false
78+
}
79+
80+
[node name="github_label" type="Label" parent="."]
81+
anchor_left = 1.0
82+
anchor_top = 1.0
83+
anchor_right = 1.0
84+
anchor_bottom = 1.0
85+
margin_left = -266.0
86+
margin_top = -14.0
87+
text = "https://github.com/xFrednet/moody-tools"
88+
__meta__ = {
89+
"_edit_use_anchors_": false
90+
}
91+
92+
[node name="backgound2" type="ColorRect" parent="github_label"]
93+
show_behind_parent = true
94+
anchor_left = 1.0
95+
anchor_top = 1.0
96+
anchor_right = 1.0
97+
anchor_bottom = 1.0
98+
margin_left = -280.0
99+
margin_top = -20.0
100+
rect_min_size = Vector2( 280, 20 )
101+
color = Color( 0.254902, 0.294118, 0.596078, 1 )
102+
__meta__ = {
103+
"_edit_use_anchors_": false
104+
}
55105
[connection signal="button_down" from="button_container/start" to="." method="_on_start_button_down"]
56106
[connection signal="button_down" from="button_container/exit" to="." method="_on_exit_button_down"]

ui/main_menu/name.png

9.25 KB
Loading

0 commit comments

Comments
 (0)