refactor: simplify sticky positioning
This commit is contained in:
parent
7cc50bb2e7
commit
2295db82b6
|
|
@ -89,7 +89,7 @@ func _smooth(current: Vector2, goal: Vector2, delta: float) -> Vector2:
|
||||||
return (1.0-k) * current + k * goal
|
return (1.0-k) * current + k * goal
|
||||||
|
|
||||||
func _process(delta: float):
|
func _process(delta: float):
|
||||||
var zone_position := Vector2(notezone.get_screen_position().x, sticky_height)
|
var zone_position := Vector2(notezone.get_screen_position().x + sticky_width / 3.0, sticky_height)
|
||||||
|
|
||||||
for note in notes:
|
for note in notes:
|
||||||
# Skip all dragged and already attached notes
|
# Skip all dragged and already attached notes
|
||||||
|
|
@ -475,14 +475,8 @@ func initialise_from_save(savegame: SaveGame) -> void:
|
||||||
card.attach_sticky_note(sticky)
|
card.attach_sticky_note(sticky)
|
||||||
print_debug(" Sticky '%s' attached to card '%s'" % [sticky.name, card_name])
|
print_debug(" Sticky '%s' attached to card '%s'" % [sticky.name, card_name])
|
||||||
else:
|
else:
|
||||||
# Sticky is loose on board
|
# Sticky is loose, this means it will be automatically moved
|
||||||
var target_position: Vector2
|
sticky.position = savegame.board_positions.get(sticky.name, position + size/2.0)
|
||||||
if savegame.board_positions.has(sticky.name):
|
|
||||||
target_position = savegame.board_positions[sticky.name]
|
|
||||||
else:
|
|
||||||
target_position = _generate_random_position()
|
|
||||||
|
|
||||||
sticky.position = target_position
|
|
||||||
|
|
||||||
sticky.picked_random = savegame.board_randoms.has(sticky.sticky_id)
|
sticky.picked_random = savegame.board_randoms.has(sticky.sticky_id)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue