2 Commits 13624a64bd ... 6089fc9e96

Author SHA1 Message Date
  Brigham Henry Keys, Esq 6089fc9e96 Added controller support 1 year ago
  Brigham Henry Keys, Esq d061e1e374 Subsciber logic complete, non subscribers don't get points 1 year ago
5 changed files with 16 additions and 7 deletions
  1. 6 0
      project.godot
  2. 4 3
      scenes/level.tscn
  3. 1 1
      scripts/hud.gd
  4. 4 2
      scripts/level.gd
  5. 1 1
      scripts/paper.gd

+ 6 - 0
project.godot

@@ -24,31 +24,37 @@ config/icon="res://assets/paper_stack.webp"
 accelerate={
 "deadzone": 0.5,
 "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
+, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
  ]
 }
 decelerate={
 "deadzone": 0.5,
 "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
+, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
  ]
 }
 left={
 "deadzone": 0.5,
 "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
+, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
  ]
 }
 right={
 "deadzone": 0.5,
 "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
+, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
  ]
 }
 pause={
 "deadzone": 0.5,
 "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":80,"unicode":0,"echo":false,"script":null)
+, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
  ]
 }
 throw={
 "deadzone": 0.5,
 "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
+, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":5,"pressure":0.0,"pressed":false,"script":null)
  ]
 }
 

+ 4 - 3
scenes/level.tscn

@@ -41,8 +41,8 @@ region_enabled = true
 region_rect = Rect2( 0, 0, 1024, 10240 )
 
 [node name="Sprite2" type="Sprite" parent="."]
-position = Vector2( 3301.58, -1986.01 )
-scale = Vector2( 6.25397, 0.597603 )
+position = Vector2( 3531.13, -2270.03 )
+scale = Vector2( 6.70231, 0.653075 )
 z_index = -6
 texture = ExtResource( 6 )
 region_enabled = true
@@ -56,6 +56,7 @@ position = Vector2( 6212.26, -5103.44 )
 z_index = 1
 
 [node name="mailbox_group" type="Node2D" parent="."]
+editor/display_folded = true
 
 [node name="mailbox0" parent="mailbox_group" instance=ExtResource( 8 )]
 position = Vector2( 5496.36, -4672.25 )
@@ -179,8 +180,8 @@ max_lines_visible = -1
 
 [connection signal="level_finished" from="player" to="." method="_on_player_level_finished"]
 [connection signal="paper_tossed" from="player" to="hud" method="_on_player_paper_tossed"]
-[connection signal="player_died" from="player" to="hud" method="_on_player_player_died"]
 [connection signal="player_died" from="player" to="." method="_on_player_player_died"]
+[connection signal="player_died" from="player" to="hud" method="_on_player_player_died"]
 [connection signal="reload_papers" from="player" to="hud" method="_on_player_reload_papers"]
 [connection signal="game_over" from="hud" to="." method="_on_hud_game_over"]
 [connection signal="out_of_papers" from="hud" to="player" method="_on_hud_out_of_papers"]

+ 1 - 1
scripts/hud.gd

@@ -18,7 +18,7 @@ func _on_player_player_died():
 	get_node("game_over").visible = true
 	emit_signal("game_over")
 
-func mailbox_hit_handler(name):
+func mailbox_hit_handler():
 	get_node("score").text = str(int(get_node("score").text) + 1000)
 
 func _on_player_reload_papers():

+ 4 - 2
scripts/level.gd

@@ -20,12 +20,14 @@ func show_day():
 	get_node("day_slide").visible = true
 	get_node("player").set_process(false)
 	yield(get_tree().create_timer(3.0), "timeout")
-	get_node("day_slide").visible = false
 	get_node("player").set_process(true)
+	get_node("day_slide").visible = false
 
 func mailbox_hit_handler(name):
 	name.erase(0, 7)
-	customers[name.to_int()] = true
+	if !get_node("mailbox_group/mailbox" + str(name.to_int()) + "/Sprite").modulate == Color(125, 125, 125):
+		customers[name.to_int()] = true
+		get_node("hud").mailbox_hit_handler()
 	
 func _on_player_level_finished():
 	# get_node("AudioStreamPlayer").play()

+ 1 - 1
scripts/paper.gd

@@ -3,7 +3,7 @@ extends RigidBody2D
 signal mailbox_hit(name)
 
 func _ready():
-	connect("mailbox_hit", get_parent().get_parent().get_node("hud"), "mailbox_hit_handler")
+	# connect("mailbox_hit", get_parent().get_parent().get_node("hud"), "mailbox_hit_handler")
 	connect("mailbox_hit", get_parent().get_parent(), "mailbox_hit_handler")
 	set_process(true)