Skip to content
This repository was archived by the owner on Sep 22, 2020. It is now read-only.

Commit b7213f9

Browse files
Synced this repository with the Godot documentation repository.
Fixed a bug in the raycast turret. Removed CONTRIBUTERS.md (see #6 for reason) Closes #3 and #18.
1 parent 721fda7 commit b7213f9

23 files changed

+533
-718
lines changed

Ammo_Pickup.gd

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
extends Spatial
2+
3+
export (int, "full size", "small") var kit_size = 0 setget kit_size_change
4+
5+
# 0 = full size pickup, 1 = small pickup
6+
const AMMO_AMOUNTS = [4, 1]
7+
const GRENADE_AMOUNTS = [2, 0]
8+
9+
const RESPAWN_TIME = 20
10+
var respawn_timer = 0
11+
12+
var is_ready = false
13+
14+
func _ready():
15+
16+
$Holder/Ammo_Pickup_Trigger.connect("body_entered", self, "trigger_body_entered")
17+
18+
is_ready = true
19+
20+
kit_size_change_values(0, false)
21+
kit_size_change_values(1, false)
22+
23+
kit_size_change_values(kit_size, true)
24+
25+
26+
func _physics_process(delta):
27+
if respawn_timer > 0:
28+
respawn_timer -= delta
29+
30+
if respawn_timer <= 0:
31+
kit_size_change_values(kit_size, true)
32+
33+
34+
func kit_size_change(value):
35+
if is_ready:
36+
37+
kit_size_change_values(kit_size, false)
38+
kit_size = value
39+
40+
kit_size_change_values(kit_size, true)
41+
else:
42+
kit_size = value
43+
44+
45+
func kit_size_change_values(size, enable):
46+
if size == 0:
47+
$Holder/Ammo_Pickup_Trigger/Shape_Kit.disabled = !enable
48+
$Holder/Ammo_Kit.visible = enable
49+
elif size == 1:
50+
$Holder/Ammo_Pickup_Trigger/Shape_Kit_Small.disabled = !enable
51+
$Holder/Ammo_Kit_Small.visible = enable
52+
53+
54+
func trigger_body_entered(body):
55+
if body.has_method("add_ammo"):
56+
body.add_ammo(AMMO_AMOUNTS[kit_size])
57+
respawn_timer = RESPAWN_TIME
58+
kit_size_change_values(kit_size, false)
59+
60+
if body.has_method("add_grenade"):
61+
body.add_grenade(GRENADE_AMOUNTS[kit_size])
62+
respawn_timer = RESPAWN_TIME
63+
kit_size_change_values(kit_size, false)

CONTRIBUTORS.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

Health_Pickup.gd

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
extends Spatial
2+
3+
export (int, "full size", "small") var kit_size = 0 setget kit_size_change
4+
5+
# 0 = full size pickup, 1 = small pickup
6+
const HEALTH_AMOUNTS = [70, 30]
7+
8+
const RESPAWN_TIME = 20
9+
var respawn_timer = 0
10+
11+
var is_ready = false
12+
13+
func _ready():
14+
15+
$Holder/Health_Pickup_Trigger.connect("body_entered", self, "trigger_body_entered")
16+
17+
is_ready = true
18+
19+
kit_size_change_values(0, false)
20+
kit_size_change_values(1, false)
21+
kit_size_change_values(kit_size, true)
22+
23+
24+
func _physics_process(delta):
25+
if respawn_timer > 0:
26+
respawn_timer -= delta
27+
28+
if respawn_timer <= 0:
29+
kit_size_change_values(kit_size, true)
30+
31+
32+
func kit_size_change(value):
33+
if is_ready:
34+
kit_size_change_values(kit_size, false)
35+
kit_size = value
36+
kit_size_change_values(kit_size, true)
37+
else:
38+
kit_size = value
39+
40+
41+
func kit_size_change_values(size, enable):
42+
if size == 0:
43+
$Holder/Health_Pickup_Trigger/Shape_Kit.disabled = !enable
44+
$Holder/Health_Kit.visible = enable
45+
elif size == 1:
46+
$Holder/Health_Pickup_Trigger/Shape_Kit_Small.disabled = !enable
47+
$Holder/Health_Kit_Small.visible = enable
48+
49+
50+
func trigger_body_entered(body):
51+
if body.has_method("add_health"):
52+
body.add_health(HEALTH_AMOUNTS[kit_size])
53+
respawn_timer = RESPAWN_TIME
54+
kit_size_change_values(kit_size, false)

Main_Menu.tscn

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,13 @@ _sections_unfolded = [ "Corner Radius" ]
143143
[sub_resource type="DynamicFont" id=5]
144144

145145
size = 32
146+
outline_size = 0
147+
outline_color = Color( 1, 1, 1, 1 )
146148
use_mipmaps = false
147149
use_filter = true
148150
font_data = ExtResource( 3 )
149151

150152
[node name="Main_Menu" type="Control" index="0"]
151-
152153
anchor_left = 0.0
153154
anchor_top = 0.0
154155
anchor_right = 1.0
@@ -167,12 +168,10 @@ ruins_level_scene = "res://assets/Ruin_Level_Objects/Ruins_Level.tscn"
167168
[node name="Background_Animation" type="Spatial" parent="." index="0"]
168169

169170
[node name="World_Environment" type="WorldEnvironment" parent="Background_Animation" index="0"]
170-
171171
environment = SubResource( 2 )
172172

173173
[node name="Main_Menu_Camera" type="Camera" parent="Background_Animation" index="1"]
174-
175-
transform = Transform( 1, -1.74846e-07, 1.74846e-07, 1.74846e-07, 1, -1.74846e-07, -1.74846e-07, 1.74846e-07, 1, 0, 0, 0 )
174+
transform = Transform( 1, -1.74846e-007, 1.74846e-007, 1.74846e-007, 1, -1.74846e-007, -1.74846e-007, 1.74846e-007, 1, 0, 0, 0 )
176175
keep_aspect = 1
177176
cull_mask = 1048575
178177
environment = null
@@ -188,7 +187,6 @@ far = 100.0
188187
_sections_unfolded = [ "Transform" ]
189188

190189
[node name="Animation_Player" type="AnimationPlayer" parent="Background_Animation" index="2"]
191-
192190
root_node = NodePath("..")
193191
autoplay = "Background_Animation"
194192
playback_process_mode = 1
@@ -199,7 +197,6 @@ blend_times = [ ]
199197
_sections_unfolded = [ "Playback Options" ]
200198

201199
[node name="Start_Menu" type="Panel" parent="." index="1"]
202-
203200
editor/display_folded = true
204201
modulate = Color( 1, 1, 1, 0.901961 )
205202
anchor_left = 0.0
@@ -220,7 +217,6 @@ custom_styles/panelnc = SubResource( 4 )
220217
_sections_unfolded = [ "custom_styles" ]
221218

222219
[node name="Title_Label" type="Label" parent="Start_Menu" index="0"]
223-
224220
anchor_left = 0.0
225221
anchor_top = 0.0
226222
anchor_right = 0.0
@@ -250,7 +246,6 @@ max_lines_visible = -1
250246
_sections_unfolded = [ "custom_constants" ]
251247

252248
[node name="Button_Start" type="Button" parent="Start_Menu" index="1"]
253-
254249
anchor_left = 0.5
255250
anchor_top = 1.0
256251
anchor_right = 0.5
@@ -277,7 +272,6 @@ align = 1
277272
_sections_unfolded = [ "custom_fonts" ]
278273

279274
[node name="Button_Open_Godot" type="Button" parent="Start_Menu" index="2"]
280-
281275
anchor_left = 0.5
282276
anchor_top = 1.0
283277
anchor_right = 0.5
@@ -304,7 +298,6 @@ align = 1
304298
_sections_unfolded = [ "custom_fonts" ]
305299

306300
[node name="Button_Options" type="Button" parent="Start_Menu" index="3"]
307-
308301
anchor_left = 0.5
309302
anchor_top = 1.0
310303
anchor_right = 0.5
@@ -331,7 +324,6 @@ align = 1
331324
_sections_unfolded = [ "custom_fonts" ]
332325

333326
[node name="Button_Quit" type="Button" parent="Start_Menu" index="4"]
334-
335327
anchor_left = 0.5
336328
anchor_top = 1.0
337329
anchor_right = 0.5
@@ -358,7 +350,6 @@ align = 1
358350
_sections_unfolded = [ "custom_fonts" ]
359351

360352
[node name="Level_Select_Menu" type="Panel" parent="." index="2"]
361-
362353
editor/display_folded = true
363354
visible = false
364355
modulate = Color( 1, 1, 1, 0.901961 )
@@ -380,7 +371,6 @@ custom_styles/panelnc = SubResource( 4 )
380371
_sections_unfolded = [ "custom_styles" ]
381372

382373
[node name="Title_Label" type="Label" parent="Level_Select_Menu" index="0"]
383-
384374
anchor_left = 0.0
385375
anchor_top = 0.0
386376
anchor_right = 0.0
@@ -409,7 +399,6 @@ max_lines_visible = -1
409399
_sections_unfolded = [ "custom_constants" ]
410400

411401
[node name="Button_Back" type="Button" parent="Level_Select_Menu" index="1"]
412-
413402
anchor_left = 0.5
414403
anchor_top = 1.0
415404
anchor_right = 0.5
@@ -436,7 +425,6 @@ align = 1
436425
_sections_unfolded = [ "custom_fonts" ]
437426

438427
[node name="Button_Level_Testing_Area" type="Button" parent="Level_Select_Menu" index="2"]
439-
440428
editor/display_folded = true
441429
anchor_left = 0.5
442430
anchor_top = 0.0
@@ -462,7 +450,6 @@ align = 1
462450
_sections_unfolded = [ "Rect" ]
463451

464452
[node name="Icon" type="TextureRect" parent="Level_Select_Menu/Button_Level_Testing_Area" index="0"]
465-
466453
anchor_left = 0.5
467454
anchor_top = 0.5
468455
anchor_right = 0.5
@@ -483,7 +470,6 @@ stretch_mode = 0
483470
_sections_unfolded = [ "Rect" ]
484471

485472
[node name="Button_Level_Space" type="Button" parent="Level_Select_Menu" index="3"]
486-
487473
editor/display_folded = true
488474
anchor_left = 0.5
489475
anchor_top = 0.0
@@ -509,7 +495,6 @@ align = 1
509495
_sections_unfolded = [ "Rect" ]
510496

511497
[node name="Icon" type="TextureRect" parent="Level_Select_Menu/Button_Level_Space" index="0"]
512-
513498
anchor_left = 0.5
514499
anchor_top = 0.5
515500
anchor_right = 0.5
@@ -530,7 +515,6 @@ stretch_mode = 0
530515
_sections_unfolded = [ "Visibility" ]
531516

532517
[node name="Button_Level_Ruins" type="Button" parent="Level_Select_Menu" index="4"]
533-
534518
editor/display_folded = true
535519
anchor_left = 0.5
536520
anchor_top = 0.0
@@ -556,7 +540,6 @@ align = 1
556540
_sections_unfolded = [ "Rect" ]
557541

558542
[node name="Icon" type="TextureRect" parent="Level_Select_Menu/Button_Level_Ruins" index="0"]
559-
560543
anchor_left = 0.5
561544
anchor_top = 0.5
562545
anchor_right = 0.5
@@ -577,7 +560,6 @@ stretch_mode = 0
577560
_sections_unfolded = [ "Visibility" ]
578561

579562
[node name="Options_Menu" type="Panel" parent="." index="3"]
580-
581563
editor/display_folded = true
582564
visible = false
583565
modulate = Color( 1, 1, 1, 0.901961 )
@@ -599,7 +581,6 @@ custom_styles/panelnc = SubResource( 4 )
599581
_sections_unfolded = [ "custom_styles" ]
600582

601583
[node name="Title_Label" type="Label" parent="Options_Menu" index="0"]
602-
603584
anchor_left = 0.0
604585
anchor_top = 0.0
605586
anchor_right = 0.0
@@ -628,7 +609,6 @@ max_lines_visible = -1
628609
_sections_unfolded = [ "custom_constants" ]
629610

630611
[node name="Label_Mouse_Sensitivity" type="Label" parent="Options_Menu" index="1"]
631-
632612
anchor_left = 0.0
633613
anchor_top = 0.0
634614
anchor_right = 0.0
@@ -652,7 +632,6 @@ max_lines_visible = -1
652632
_sections_unfolded = [ "custom_fonts" ]
653633

654634
[node name="HSlider_Mouse_Sensitivity" type="HSlider" parent="Options_Menu" index="2"]
655-
656635
anchor_left = 0.0
657636
anchor_top = 0.0
658637
anchor_right = 0.0
@@ -675,13 +654,14 @@ page = 0.0
675654
value = 0.01
676655
exp_edit = false
677656
rounded = false
657+
allow_greater = false
658+
allow_lesser = false
678659
editable = true
679660
tick_count = 0
680661
ticks_on_borders = false
681662
focus_mode = 2
682663

683664
[node name="Label_Joypad_Sensitivity" type="Label" parent="Options_Menu" index="3"]
684-
685665
anchor_left = 0.0
686666
anchor_top = 0.0
687667
anchor_right = 0.0
@@ -705,7 +685,6 @@ max_lines_visible = -1
705685
_sections_unfolded = [ "custom_fonts" ]
706686

707687
[node name="HSlider_Joypad_Sensitivity" type="HSlider" parent="Options_Menu" index="4"]
708-
709688
anchor_left = 0.0
710689
anchor_top = 0.0
711690
anchor_right = 0.0
@@ -728,13 +707,14 @@ page = 0.0
728707
value = 0.1
729708
exp_edit = false
730709
rounded = false
710+
allow_greater = false
711+
allow_lesser = false
731712
editable = true
732713
tick_count = 0
733714
ticks_on_borders = false
734715
focus_mode = 2
735716

736717
[node name="Check_Button_VSync" type="CheckButton" parent="Options_Menu" index="5"]
737-
738718
anchor_left = 0.5
739719
anchor_top = 1.0
740720
anchor_right = 0.5
@@ -762,7 +742,6 @@ align = 0
762742
_sections_unfolded = [ "custom_fonts" ]
763743

764744
[node name="Button_Fullscreen" type="Button" parent="Options_Menu" index="6"]
765-
766745
anchor_left = 0.5
767746
anchor_top = 1.0
768747
anchor_right = 0.5
@@ -789,7 +768,6 @@ align = 1
789768
_sections_unfolded = [ "custom_fonts" ]
790769

791770
[node name="Check_Button_Debug" type="CheckButton" parent="Options_Menu" index="7"]
792-
793771
anchor_left = 0.5
794772
anchor_top = 1.0
795773
anchor_right = 0.5
@@ -816,7 +794,6 @@ align = 0
816794
_sections_unfolded = [ "custom_fonts" ]
817795

818796
[node name="Button_Back" type="Button" parent="Options_Menu" index="8"]
819-
820797
anchor_left = 0.5
821798
anchor_top = 1.0
822799
anchor_right = 0.5
@@ -842,4 +819,3 @@ flat = false
842819
align = 1
843820
_sections_unfolded = [ "custom_fonts" ]
844821

845-

0 commit comments

Comments
 (0)