Small Godot Wild Jam game
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Double rewards on house type

+46 -14
+2 -1
Scenes/gameplay/gameplay.gd
··· 47 47 SignalBus.play_error.connect(play_error) 48 48 49 49 50 - func _on_event_pin_clicked(house_name: String, target_location: Vector2): 50 + func _on_event_pin_clicked(house_name: String, target_location: Vector2, house_type: Global.HouseType): 51 51 var new_dialogue_container = DIALOGUE_CONTAINER.instantiate() 52 52 ui_layer.add_child(new_dialogue_container) 53 53 54 54 # Use the house_name variable to send the icon of the doctor or preist to the event point that has that house name as its parent 55 55 Global.target_location = target_location 56 + Global.target_house_type = house_type 56 57 57 58 func random_house_select() -> Node2D: 58 59 var random_index = randi() % possible_event_nodes.get_child_count()
+1 -1
Scenes/house_base/house_base.tscn
··· 31 31 event_signal_ping.visible = false 32 32 has_event = false 33 33 var nav: NavPoint = find_children(\"*\", \"NavPoint\").front() 34 - SignalBus.event_pin_clicked.emit(name, nav.global_position) 34 + SignalBus.event_pin_clicked.emit(name, nav.global_position, house_type) 35 35 print(name) 36 36 else: 37 37 SignalBus.play_error.emit()
+3 -1
Scenes/unit/unit.gd
··· 9 9 @export var unit_type: Global.UnitType 10 10 11 11 var was_correct: bool 12 + var house_type: Global.HouseType 12 13 13 14 var path: PackedVector2Array = [] 14 15 var reverse_path = [] ··· 50 51 progress_bar.visible = true 51 52 52 53 func _treat_patient() -> void: 53 - Global.handle_choice_result(was_correct) 54 + Global.handle_choice_result(was_correct, house_type) 54 55 treated_patient = true 55 56 progress_bar.visible = false 56 57 ··· 64 65 reverse_path.remove_at(0) 65 66 position = next_pos 66 67 else: 68 + Global.add_unit(unit_type) 67 69 queue_free()
+37 -9
Scripts/global.gd
··· 20 20 people_sick = value 21 21 SignalBus.update_ui_metrics.emit() 22 22 23 - var available_doctors: int = 2 24 - var available_priests: int = 3 23 + var available_doctors: int = 2: 24 + get: 25 + return available_doctors 26 + set(value): 27 + available_doctors = value 28 + SignalBus.update_ui_metrics.emit() 29 + var available_priests: int = 3: 30 + get: 31 + return available_priests 32 + set(value): 33 + available_priests = value 34 + SignalBus.update_ui_metrics.emit() 25 35 26 36 enum UnitType {DOCTOR, PRIEST} 27 37 enum HouseType {PEASANT, NOBLE} ··· 29 39 const STARTER_SICK_COUNTER: int = 15 30 40 31 41 var target_location: Vector2 42 + var target_house_type: HouseType 32 43 #endregion 33 44 34 45 func can_spawn_unit() -> bool: 35 46 return (available_doctors + available_priests > 0) 36 47 37 - func handle_choice_result(result: bool) -> void: 48 + func handle_choice_result(result: bool, house_type: HouseType) -> void: 38 49 if result: 39 - people_cured += 1 40 - people_sick -= 3 50 + var mult: int = 1 51 + if house_type == HouseType.NOBLE: 52 + mult = 2 53 + people_cured += 1 * mult 54 + people_sick -= 3 * mult 41 55 #SignalBus.play_cured.emit() 42 56 else: 43 57 people_sick += 2 ··· 47 61 Console.register_custom_command("debug", _toggle_debug_mode) 48 62 #Console.register_custom_command("spawn_doctor", _spawn_unit) 49 63 50 - func set_cured(): 51 - pass 52 - 53 64 func get_target_location() -> Vector2: 54 65 return target_location 55 66 67 + func get_target_house() -> HouseType: 68 + return target_house_type 56 69 70 + func remove_unit(type: UnitType) -> void: 71 + match type: 72 + UnitType.DOCTOR: 73 + if available_doctors > 0: 74 + available_doctors -= 1 75 + 76 + UnitType.PRIEST: 77 + if available_priests > 0: 78 + available_priests -= 1 57 79 58 - 80 + func add_unit(type: UnitType) -> void: 81 + match type: 82 + UnitType.DOCTOR: 83 + available_doctors += 1 84 + 85 + UnitType.PRIEST: 86 + available_priests += 1 59 87 60 88 61 89
+2 -2
Scripts/signal_bus.gd
··· 1 1 extends Node 2 2 3 3 signal debug_mode_changed 4 - signal spawn_unit_request(type: Global.UnitType, target_location: Vector2, was_correct: bool) 4 + signal spawn_unit_request(type: Global.UnitType, target_location: Vector2, was_correct: bool, house_type: Global.HouseType) 5 5 6 - signal event_pin_clicked(name: String, target_pos: Vector2) 6 + signal event_pin_clicked(name: String, target_pos: Vector2, house_type: Global.HouseType) 7 7 8 8 signal update_ui_metrics 9 9
+1
Scripts/unit_manager.gd
··· 39 39 # Moving state around like this isn't really good but it's fine for now 40 40 unit.was_correct = was_correct 41 41 42 + Global.remove_unit(unit.unit_type) 42 43 add_child(unit) 43 44 44 45