Improve chapter one map controls

This commit is contained in:
2026-06-19 16:59:58 +09:00
parent a851eef72b
commit e70a4da0a6
2 changed files with 44 additions and 5 deletions

View File

@@ -48,6 +48,7 @@ const FLOATING_TEXT_LIFETIME := 1.0
const FLOATING_TEXT_RISE := 42.0
const OBJECTIVE_NOTICE_DURATION := 2.6
const EDGE_SCROLL_MARGIN := 48.0
const EDGE_SCROLL_OUTER_MARGIN := 28.0
const EDGE_SCROLL_MIN_SPEED := 80.0
const EDGE_SCROLL_MAX_SPEED := 430.0
const UNIT_MOVE_ANIMATION_DURATION := 0.18
@@ -3114,7 +3115,10 @@ func _draw_units() -> void:
var sprite_modulate := _unit_sprite_modulate(unit, acted)
draw_circle(center + Vector2(0, 17), 20, Color(0.0, 0.0, 0.0, 0.30))
_draw_unit_class_emblem(rect, center, unit, team_color)
_draw_pixel_unit_sprite(rect, unit, team_color, sprite_modulate)
_draw_unit_identity_marks(rect, center, unit, team_color)
_draw_unit_class_badge(rect, unit, team_color)
var hp_ratio := float(unit["hp"]) / float(max(1, int(unit["max_hp"])))
var hp_back := Rect2(rect.position + Vector2(8, TILE_SIZE - 8), Vector2(TILE_SIZE - 16, 5))
@@ -4385,7 +4389,7 @@ func _clamped_board_scroll_offset(offset: Vector2) -> Vector2:
func _edge_scroll_velocity_for_position(mouse_position: Vector2, view_rect: Rect2) -> Vector2:
if not view_rect.has_point(mouse_position):
if not _edge_scroll_activation_rect(view_rect).has_point(mouse_position):
return Vector2.ZERO
var velocity := Vector2(
_edge_scroll_axis_velocity(mouse_position.x, view_rect.position.x, view_rect.end.x, 1.0),
@@ -4394,6 +4398,10 @@ func _edge_scroll_velocity_for_position(mouse_position: Vector2, view_rect: Rect
return _capped_edge_scroll_velocity(velocity)
func _edge_scroll_activation_rect(view_rect: Rect2) -> Rect2:
return view_rect.grow(EDGE_SCROLL_OUTER_MARGIN)
func _capped_edge_scroll_velocity(velocity: Vector2) -> Vector2:
if velocity == Vector2.ZERO or velocity.length() <= EDGE_SCROLL_MAX_SPEED:
return velocity