Compare commits
2 Commits
e280b7dc72
...
e36bbd36dc
Author | SHA1 | Date |
---|---|---|
|
e36bbd36dc | |
|
fe7db59dd8 |
|
@ -47,19 +47,21 @@ text = "INV"
|
||||||
|
|
||||||
[node name="HealthBar" type="ProgressBar" parent="Camera2D/CanvasLayer/VBoxContainer"]
|
[node name="HealthBar" type="ProgressBar" parent="Camera2D/CanvasLayer/VBoxContainer"]
|
||||||
modulate = Color(0.787561, 0.0888135, 0.00437393, 1)
|
modulate = Color(0.787561, 0.0888135, 0.00437393, 1)
|
||||||
custom_minimum_size = Vector2(150, 15)
|
custom_minimum_size = Vector2(150, 20)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
tooltip_text = "
|
||||||
|
"
|
||||||
show_percentage = false
|
show_percentage = false
|
||||||
|
|
||||||
[node name="FoodBar" type="ProgressBar" parent="Camera2D/CanvasLayer/VBoxContainer"]
|
[node name="FoodBar" type="ProgressBar" parent="Camera2D/CanvasLayer/VBoxContainer"]
|
||||||
modulate = Color(0.166826, 0.552224, 0.153144, 1)
|
modulate = Color(0.166826, 0.552224, 0.153144, 1)
|
||||||
custom_minimum_size = Vector2(0, 15)
|
custom_minimum_size = Vector2(0, 20)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
show_percentage = false
|
show_percentage = false
|
||||||
|
|
||||||
[node name="TemperatureBar" type="ProgressBar" parent="Camera2D/CanvasLayer/VBoxContainer"]
|
[node name="TemperatureBar" type="ProgressBar" parent="Camera2D/CanvasLayer/VBoxContainer"]
|
||||||
modulate = Color(0.0235294, 0.0392157, 1, 1)
|
modulate = Color(0.0235294, 0.0392157, 1, 1)
|
||||||
custom_minimum_size = Vector2(0, 15)
|
custom_minimum_size = Vector2(0, 20)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
max_value = 50.0
|
max_value = 50.0
|
||||||
show_percentage = false
|
show_percentage = false
|
||||||
|
@ -69,6 +71,22 @@ layout_mode = 2
|
||||||
expand_mode = 5
|
expand_mode = 5
|
||||||
stretch_mode = 5
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="HealthLabel" type="Label" parent="Camera2D/CanvasLayer"]
|
||||||
|
offset_left = 1.0
|
||||||
|
offset_top = 26.0
|
||||||
|
offset_right = 151.0
|
||||||
|
offset_bottom = 49.0
|
||||||
|
|
||||||
|
[node name="FoodLabel" type="Label" parent="Camera2D/CanvasLayer"]
|
||||||
|
offset_top = 50.0
|
||||||
|
offset_right = 150.0
|
||||||
|
offset_bottom = 73.0
|
||||||
|
|
||||||
|
[node name="TemperatureLabel" type="Label" parent="Camera2D/CanvasLayer"]
|
||||||
|
offset_top = 74.0
|
||||||
|
offset_right = 150.0
|
||||||
|
offset_bottom = 97.0
|
||||||
|
|
||||||
[node name="Tileset" type="Node2D" parent="."]
|
[node name="Tileset" type="Node2D" parent="."]
|
||||||
script = ExtResource("1_k0rw8")
|
script = ExtResource("1_k0rw8")
|
||||||
|
|
||||||
|
|
|
@ -16,72 +16,73 @@ var tilemap_navigation: TilemapNavigation = TilemapNavigation.new()
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
tilemap_navigation.world = world
|
tilemap_navigation.world = world
|
||||||
tilemap_navigation.player = player
|
tilemap_navigation.player = player
|
||||||
player.game_manager = self
|
player.game_manager = self
|
||||||
world.camp_manager.game_manager = self
|
world.camp_manager.game_manager = self
|
||||||
world.step_visualizer.game_manager = self
|
world.step_visualizer.game_manager = self
|
||||||
world.step_visualizer.world = world
|
world.step_visualizer.world = world
|
||||||
health_bar.value = player.max_health
|
update_bars()
|
||||||
food_bar.value = player.max_food
|
$Camera2D/CanvasLayer/VBoxContainer/TextureRect.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_CHEST)
|
||||||
temperature_bar.value = player.temperature_endure
|
|
||||||
update_bars()
|
|
||||||
$Camera2D/CanvasLayer/VBoxContainer/TextureRect.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_CHEST)
|
|
||||||
|
|
||||||
|
|
||||||
# game_ticker.start()
|
# game_ticker.start()
|
||||||
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if Input.is_action_just_pressed("key_1"):
|
if Input.is_action_just_pressed("key_1"):
|
||||||
camera.go_to_zooming(Vector2(517.469787597656, 289.846008300781), 1.771561)
|
camera.go_to_zooming(Vector2(517.469787597656, 289.846008300781), 1.771561)
|
||||||
if Input.is_action_just_pressed("key_2"):
|
if Input.is_action_just_pressed("key_2"):
|
||||||
camera.go_to_zooming(Vector2(789.883972167969, 450.102813720703), 0.56015348434448)
|
camera.go_to_zooming(Vector2(789.883972167969, 450.102813720703), 0.56015348434448)
|
||||||
if Input.is_action_just_pressed("key_9"):
|
if Input.is_action_just_pressed("key_9"):
|
||||||
world.camp_manager.campfire_light()
|
world.camp_manager.campfire_light()
|
||||||
world.camp_manager.sleep_effect()
|
world.camp_manager.sleep_effect()
|
||||||
world.camp_manager.campfire_extinguish()
|
world.camp_manager.campfire_extinguish()
|
||||||
if Input.is_action_just_pressed("force_game_tick"):
|
if Input.is_action_just_pressed("force_game_tick"):
|
||||||
_on_game_tick_timeout()
|
_on_game_tick_timeout()
|
||||||
if Input.is_action_just_pressed("key_6"):
|
if Input.is_action_just_pressed("key_6"):
|
||||||
toggle_temperature_layer()
|
toggle_temperature_layer()
|
||||||
|
|
||||||
|
|
||||||
func player_health_depleted():
|
func player_health_depleted():
|
||||||
# TODO
|
# TODO
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
func _on_game_tick_timeout() -> void:
|
func _on_game_tick_timeout() -> void:
|
||||||
var timer_on_game_tick_timeout: PerformanceTimer = PerformanceTimer.new()
|
var timer_on_game_tick_timeout: PerformanceTimer = PerformanceTimer.new()
|
||||||
timer_on_game_tick_timeout.display_name = "game tick duration"
|
timer_on_game_tick_timeout.display_name = "game tick duration"
|
||||||
tilemap_navigation.game_tick_start()
|
tilemap_navigation.game_tick_start()
|
||||||
world.step_visualizer.game_tick_start()
|
world.step_visualizer.game_tick_start()
|
||||||
player.game_tick()
|
player.game_tick()
|
||||||
tilemap_navigation.game_tick_end()
|
tilemap_navigation.game_tick_end()
|
||||||
world.step_visualizer.game_tick_end()
|
world.step_visualizer.game_tick_end()
|
||||||
timer_on_game_tick_timeout.stop()
|
timer_on_game_tick_timeout.stop()
|
||||||
update_bars()
|
update_bars()
|
||||||
|
|
||||||
|
|
||||||
func update_bars() -> void:
|
func update_bars() -> void:
|
||||||
if health_bar != null:
|
if health_bar != null:
|
||||||
health_bar.max_value = player.max_health
|
health_bar.max_value = player.max_health
|
||||||
health_bar.value = clamp(player.health, 0, player.max_health)
|
health_bar.value = clamp(player.health, 0, player.max_health)
|
||||||
|
$Camera2D/CanvasLayer/HealthLabel.text = str(player.health) + "/" + str(player.max_health)
|
||||||
|
$Camera2D/CanvasLayer/HealthLabel.add_theme_color_override("font_color", Color(1, 1, 1))
|
||||||
|
|
||||||
if food_bar != null:
|
if food_bar != null:
|
||||||
food_bar.max_value = player.max_food
|
food_bar.max_value = player.max_food
|
||||||
food_bar.value = clamp(player.food, 0, player.max_food)
|
food_bar.value = clamp(player.food, 0, player.max_food)
|
||||||
|
$Camera2D/CanvasLayer/FoodLabel.text = str(player.food) + "/" + str(player.max_food)
|
||||||
if temperature_bar != null:
|
|
||||||
var temperature_value = player.temperature_endure - player.temperature_timer
|
|
||||||
temperature_bar.max_value = player.temperature_endure
|
|
||||||
temperature_bar.value = clamp(temperature_value, 0, player.temperature_endure)
|
|
||||||
|
|
||||||
|
if temperature_bar != null:
|
||||||
|
var temperature_value = player.temperature_endure - player.temperature_timer
|
||||||
|
temperature_bar.max_value = player.temperature_endure
|
||||||
|
temperature_bar.value = clamp(temperature_value, 0, player.temperature_endure)
|
||||||
|
$Camera2D/CanvasLayer/TemperatureLabel.text = str(player.temperature_endure) + "/" + str(player.max_temperature)
|
||||||
|
|
||||||
|
|
||||||
func toggle_temperature_layer() -> void:
|
func toggle_temperature_layer() -> void:
|
||||||
if temperature_layer != null:
|
if temperature_layer != null:
|
||||||
temperature_layer.visible = not temperature_layer.visible
|
temperature_layer.visible = not temperature_layer.visible
|
||||||
print("TemperatureLayer visibility:", temperature_layer.visible)
|
print("TemperatureLayer visibility:", temperature_layer.visible)
|
||||||
else:
|
else:
|
||||||
print("TemperatureLayer is null!")
|
print("TemperatureLayer is null!")
|
||||||
|
|
|
@ -10,6 +10,8 @@ extends Node
|
||||||
@export var food_addon_per_berry: int = 100
|
@export var food_addon_per_berry: int = 100
|
||||||
@export var food_critical_threshold: int = 50
|
@export var food_critical_threshold: int = 50
|
||||||
# temperature
|
# temperature
|
||||||
|
@export var max_temperature: int = 50
|
||||||
|
@export var temperature: int
|
||||||
@export var temperature_damage: int = 1
|
@export var temperature_damage: int = 1
|
||||||
@export var temperature_endure: int = 50
|
@export var temperature_endure: int = 50
|
||||||
# viewing
|
# viewing
|
||||||
|
|
Loading…
Reference in New Issue